console 1.23.0 → 1.23.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d9f91e3e103d4d8999923473901b90855e7c8ee5a2f1bf5fa7be4b87a435e0e2
4
- data.tar.gz: 78cc14aa29facd5ef1909fc08bcd255d11c251f1075dbe92692f26a249557cbf
3
+ metadata.gz: f053978f1ebc28b2973844d0ef018eeb200651ffb9bf00702a09ca3b04614fce
4
+ data.tar.gz: 4f8177c79c3e0d4f9b43e0e4b2c3f02e72837ca7d31e76a6eff308b41848e064
5
5
  SHA512:
6
- metadata.gz: bda52b2ed24d9825905e8e929809d9629ba61755059d7e00ef8ceb693839a191d98647bc13fd2c3a7699f8f664560e4f35c316e21bb9e37c24b8d1265c31dd91
7
- data.tar.gz: 22a7f6c0be0617140c608b5063c25d3dd220670afc570860f0cd54fea36f889c3b128d168f9dd6bf92c01c271e335b4d73dfd06cfe918f2360911aa8991fcfba
6
+ metadata.gz: 01bed9d6648e51ca76c7af4944f640eff416510bd7160ce9e9fd54c6c6397a213b45cfe8b4628d0e2071716b2651362e187f119d82053b85a7c4e5bb06d66fed
7
+ data.tar.gz: 80de59979995f867f791052666b20d5d1f50ed01a74af4529797b604934b3f18e064f113963b55014c5f90497b40be82ba124443036f8cb34414b48e6c6bc50b
checksums.yaml.gz.sig CHANGED
Binary file
@@ -18,7 +18,7 @@ module Console
18
18
 
19
19
  def dump(object)
20
20
  @format.dump(object, @limit)
21
- rescue => error
21
+ rescue SystemStackError, StandardError => error
22
22
  @format.dump(safe_dump(object, error))
23
23
  end
24
24
 
@@ -28,6 +28,23 @@ module Console
28
28
  Hash.new.compare_by_identity
29
29
  end
30
30
 
31
+ # The first N frames, noting that the last frame is a placeholder for all the skipped frames:
32
+ FIRST_N_FRAMES = 10 + 1
33
+ LAST_N_FRAMES = 20
34
+ MAXIMUM_FRAMES = FIRST_N_FRAMES + LAST_N_FRAMES
35
+
36
+ def filter_backtrace(error)
37
+ frames = error.backtrace
38
+
39
+ # Select only the first and last few frames:
40
+ if frames.size > MAXIMUM_FRAMES
41
+ frames[FIRST_N_FRAMES-1] = "[... #{frames.size - (MAXIMUM_FRAMES-1)} frames ...]"
42
+ frames.slice!(FIRST_N_FRAMES...-LAST_N_FRAMES)
43
+ end
44
+
45
+ return frames
46
+ end
47
+
31
48
  def safe_dump(object, error)
32
49
  object = safe_dump_recurse(object)
33
50
 
@@ -35,6 +52,7 @@ module Console
35
52
  object[:error] = {
36
53
  class: safe_dump_recurse(error.class.name),
37
54
  message: safe_dump_recurse(error.message),
55
+ backtrace: safe_dump_recurse(filter_backtrace(error)),
38
56
  }
39
57
 
40
58
  return object
@@ -4,5 +4,5 @@
4
4
  # Copyright, 2019-2023, by Samuel Williams.
5
5
 
6
6
  module Console
7
- VERSION = "1.23.0"
7
+ VERSION = "1.23.1"
8
8
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: console
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.23.0
4
+ version: 1.23.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
metadata.gz.sig CHANGED
Binary file