better_errors 2.6.0 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of better_errors might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b8cb5c2454ca55776cbfa1c596788008c56d584202c55fc0599e9fbb0c6d45e9
4
- data.tar.gz: ac7de8121e985ef3277da64604a72e1c117bddba34fa15aa5e838a2bb937bcb7
3
+ metadata.gz: f0a9449e2952fc0366176c6e7160b9c3dc0ea875902510fd60d6f6e54e0b8110
4
+ data.tar.gz: f03dd3cf91ed360f4bd0a826e7b99827b9149f50efff44ea8dbc8bb1b585fa45
5
5
  SHA512:
6
- metadata.gz: 4ae119905448207a0af32b0f62fe812c533fe6bc990c85fb5b10066696be80f8ea44ad141a8eb4c7435180042c964a2258c8a5212bf56eb2c45050621aaa467a
7
- data.tar.gz: 2ad99de05bd4905a79cd05bd5428b336e1cdf79d84889d3c6331275749fed3912671ed43e308e86d5afbccc83767ae43e4288bb48fccd00c205cd0c23571ece3
6
+ metadata.gz: e70808745a84bd58172df545a84371e64f7a42c0dc330ae44b271b759194ae534f7afb918d890c321e0dc075dc9cc66082e0ec9cef0dd769a3738ffa1aafcbd3
7
+ data.tar.gz: 1d69c89a9b05b116eac00cc03267abcd831bbcb9314f7462ea13279f5960db3abdab27c408f517af79259e837f60403650196fa06acacb59a820b8cdc166dcd1
@@ -1,4 +1,3 @@
1
- sudo: false
2
1
  language: ruby
3
2
  cache: bundler
4
3
  notifications:
@@ -12,20 +11,25 @@ rvm:
12
11
  - 2.3.8
13
12
  - 2.4.9
14
13
  - 2.5.7
14
+ - 2.6.5
15
+ - 2.7.0
15
16
  - ruby-head
16
17
  gemfile:
17
18
  - gemfiles/rails42.gemfile
18
19
  - gemfiles/rails50.gemfile
19
20
  - gemfiles/rails51.gemfile
20
21
  - gemfiles/rails52.gemfile
22
+ - gemfiles/rails60.gemfile
21
23
  - gemfiles/rails42_haml.gemfile
22
24
  - gemfiles/rails50_haml.gemfile
23
25
  - gemfiles/rails51_haml.gemfile
24
26
  - gemfiles/rails52_haml.gemfile
27
+ - gemfiles/rails60_haml.gemfile
25
28
  - gemfiles/rails42_boc.gemfile
26
29
  - gemfiles/rails50_boc.gemfile
27
30
  - gemfiles/rails51_boc.gemfile
28
31
  - gemfiles/rails52_boc.gemfile
32
+ - gemfiles/rails60_boc.gemfile
29
33
  - gemfiles/rack.gemfile
30
34
  - gemfiles/rack_boc.gemfile
31
35
  - gemfiles/pry09.gemfile
@@ -38,21 +42,57 @@ matrix:
38
42
  - gemfile: gemfiles/pry010.gemfile
39
43
  - gemfile: gemfiles/pry011.gemfile
40
44
  exclude:
45
+ - rvm: 2.2.10
46
+ gemfile: gemfiles/rails60.gemfile
47
+ - rvm: 2.2.10
48
+ gemfile: gemfiles/rails60_boc.gemfile
49
+ - rvm: 2.2.10
50
+ gemfile: gemfiles/rails60_haml.gemfile
41
51
  - rvm: 2.3.8
42
52
  gemfile: gemfiles/rails42.gemfile
43
53
  - rvm: 2.3.8
44
54
  gemfile: gemfiles/rails42_boc.gemfile
45
55
  - rvm: 2.3.8
46
56
  gemfile: gemfiles/rails42_haml.gemfile
57
+ - rvm: 2.3.8
58
+ gemfile: gemfiles/rails60.gemfile
59
+ - rvm: 2.3.8
60
+ gemfile: gemfiles/rails60_boc.gemfile
61
+ - rvm: 2.3.8
62
+ gemfile: gemfiles/rails60_haml.gemfile
47
63
  - rvm: 2.4.9
48
64
  gemfile: gemfiles/rails42.gemfile
49
65
  - rvm: 2.4.9
50
66
  gemfile: gemfiles/rails42_boc.gemfile
51
67
  - rvm: 2.4.9
52
68
  gemfile: gemfiles/rails42_haml.gemfile
69
+ - rvm: 2.4.9
70
+ gemfile: gemfiles/rails60.gemfile
71
+ - rvm: 2.4.9
72
+ gemfile: gemfiles/rails60_boc.gemfile
73
+ - rvm: 2.4.9
74
+ gemfile: gemfiles/rails60_haml.gemfile
53
75
  - rvm: 2.5.7
54
76
  gemfile: gemfiles/rails42.gemfile
55
77
  - rvm: 2.5.7
56
78
  gemfile: gemfiles/rails42_boc.gemfile
57
79
  - rvm: 2.5.7
58
80
  gemfile: gemfiles/rails42_haml.gemfile
81
+ - rvm: 2.6.5
82
+ gemfile: gemfiles/rails42.gemfile
83
+ - rvm: 2.6.5
84
+ gemfile: gemfiles/rails42_boc.gemfile
85
+ - rvm: 2.6.5
86
+ gemfile: gemfiles/rails42_haml.gemfile
87
+ - rvm: 2.7.0
88
+ gemfile: gemfiles/rails42.gemfile
89
+ - rvm: 2.7.0
90
+ gemfile: gemfiles/rails42_boc.gemfile
91
+ - rvm: 2.7.0
92
+ gemfile: gemfiles/rails42_haml.gemfile
93
+ - rvm: ruby-head
94
+ gemfile: gemfiles/rails42.gemfile
95
+ - rvm: ruby-head
96
+ gemfile: gemfiles/rails42_boc.gemfile
97
+ - rvm: ruby-head
98
+ gemfile: gemfiles/rails42_haml.gemfile
data/README.md CHANGED
@@ -93,6 +93,16 @@ See [the wiki for instructions on configuring the editor](https://github.com/Bet
93
93
  BetterErrors.maximum_variable_inspect_size = 100_000
94
94
  ```
95
95
 
96
+ ## Ignore inspection of variables with certain classes.
97
+
98
+ ```ruby
99
+ # e.g. in config/initializers/better_errors.rb
100
+ # This will stop BetterErrors from trying to inspect objects of these classes, which can cause
101
+ # slow loading times and unneccessary database queries. Does not check inheritance chain, use
102
+ # strings not contants.
103
+ # default value: ['ActionDispatch::Request', 'ActionDispatch::Response']
104
+ BetterErrors.ignored_classes = ['ActionDispatch::Request', 'ActionDispatch::Response']
105
+ ```
96
106
 
97
107
  ## Get in touch!
98
108
 
@@ -22,6 +22,7 @@ Gem::Specification.new do |s|
22
22
 
23
23
  s.add_development_dependency "rake", "~> 10.0"
24
24
  s.add_development_dependency "rspec", "~> 3.5"
25
+ s.add_development_dependency "rspec-html-matchers"
25
26
  s.add_development_dependency "rspec-its"
26
27
  s.add_development_dependency "yard"
27
28
  # kramdown 2.1 requires Ruby 2.3+
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "rails", "~> 6.0.0"
4
+
5
+ gem 'coveralls', require: false
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,8 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "rails", "~> 6.0.0"
4
+ gem "binding_of_caller"
5
+
6
+ gem 'coveralls', require: false
7
+
8
+ gemspec path: "../"
@@ -0,0 +1,8 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "rails", "~> 6.0.0"
4
+ gem "haml"
5
+
6
+ gem 'coveralls', require: false
7
+
8
+ gemspec path: "../"
@@ -21,6 +21,7 @@ module BetterErrors
21
21
  { symbols: [:idea], sniff: /idea/i, url: "idea://open?file=%{file}&line=%{line}" },
22
22
  { symbols: [:rubymine], sniff: /mine/i, url: "x-mine://open?file=%{file}&line=%{line}" },
23
23
  { symbols: [:vscode, :code], sniff: /code/i, url: "vscode://file/%{file}:%{line}" },
24
+ { symbols: [:vscodium, :codium], sniff: /codium/i, url: "vscodium://file/%{file}:%{line}" },
24
25
  { symbols: [:atom], sniff: /atom/i, url: "atom://core/open/file?filename=%{file}&line=%{line}" },
25
26
  ]
26
27
 
@@ -54,9 +55,14 @@ module BetterErrors
54
55
  # the variable won't be returned.
55
56
  # @return int
56
57
  attr_accessor :maximum_variable_inspect_size
58
+
59
+ # List of classes that are excluded from inspection.
60
+ # @return [Array]
61
+ attr_accessor :ignored_classes
57
62
  end
58
63
  @ignored_instance_variables = []
59
64
  @maximum_variable_inspect_size = 100_000
65
+ @ignored_classes = ['ActionDispatch::Request', 'ActionDispatch::Response']
60
66
 
61
67
  # Returns a proc, which when called with a filename and line number argument,
62
68
  # returns a URL to open the filename and line in the selected editor.
@@ -105,7 +105,13 @@ module BetterErrors
105
105
  end
106
106
 
107
107
  def inspect_value(obj)
108
- InspectableValue.new(obj).to_html
108
+ if BetterErrors.ignored_classes.include? obj.class.name
109
+ "<span class='unsupported'>(Instance of ignored class. "\
110
+ "#{obj.class.name ? "Remove #{CGI.escapeHTML(obj.class.name)} from" : "Modify"}"\
111
+ " BetterErrors.ignored_classes if you need to see it.)</span>"
112
+ else
113
+ InspectableValue.new(obj).to_html
114
+ end
109
115
  rescue BetterErrors::ValueLargerThanConfiguredMaximum
110
116
  "<span class='unsupported'>(Object too large. "\
111
117
  "#{obj.class.name ? "Modify #{CGI.escapeHTML(obj.class.name)}#inspect or a" : "A"}"\
@@ -4,9 +4,8 @@ module BetterErrors
4
4
  attr_reader :exception, :message, :backtrace
5
5
 
6
6
  def initialize(exception)
7
- if exception.respond_to?(:cause)
8
- exception = exception.cause if exception.cause
9
- elsif exception.respond_to?(:original_exception) && exception.original_exception
7
+ if exception.respond_to?(:original_exception) && exception.original_exception
8
+ # This supports some specific Rails exceptions, and is not intended to act the same as `#cause`.
10
9
  exception = exception.original_exception
11
10
  end
12
11
 
@@ -36,8 +35,13 @@ module BetterErrors
36
35
 
37
36
  def setup_backtrace_from_bindings
38
37
  @backtrace = exception.__better_errors_bindings_stack.map { |binding|
39
- file = binding.eval "__FILE__"
40
- line = binding.eval "__LINE__"
38
+ if binding.respond_to?(:source_location) # Ruby >= 2.6
39
+ file = binding.source_location[0]
40
+ line = binding.source_location[1]
41
+ else
42
+ file = binding.eval "__FILE__"
43
+ line = binding.eval "__LINE__"
44
+ end
41
45
  name = binding.frame_description
42
46
  StackFrame.new(file, line, name, binding)
43
47
  }
@@ -1,3 +1,3 @@
1
1
  module BetterErrors
2
- VERSION = "2.6.0"
2
+ VERSION = "2.7.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: better_errors
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.0
4
+ version: 2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charlie Somerville
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-25 00:00:00.000000000 Z
11
+ date: 2020-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3.5'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec-html-matchers
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rspec-its
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -157,6 +171,9 @@ files:
157
171
  - gemfiles/rails52.gemfile
158
172
  - gemfiles/rails52_boc.gemfile
159
173
  - gemfiles/rails52_haml.gemfile
174
+ - gemfiles/rails60.gemfile
175
+ - gemfiles/rails60_boc.gemfile
176
+ - gemfiles/rails60_haml.gemfile
160
177
  - lib/better_errors.rb
161
178
  - lib/better_errors/code_formatter.rb
162
179
  - lib/better_errors/code_formatter/html.rb