better_errors 2.8.0 → 2.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 10f7411145be495cf17cbebdf087e1bb21fe8c6fc8c07397fa406e7fc1f9f917
4
- data.tar.gz: 3b14b75eaa97285c3ad5f685671348694aa7174cc43e52826e49e21a2f139b0d
3
+ metadata.gz: 59e37a4996e35b2775a359cbe11302a8ded7213d7e940905a92cfe39d872e2e9
4
+ data.tar.gz: f162b4cbb8d5fc3c285c466ecbfb449626337e724cd0c8964fcbc7fb3784288b
5
5
  SHA512:
6
- metadata.gz: 141e1056c402ed7b0aa0965278018096ca1d2bc4032072692c1f146ad09d6848d87792d665ecc6dcb41322594e91d9a5e27955edc560bb665a2995f150c0be4e
7
- data.tar.gz: 03a94aa9fdcd0340b1fdf913a52978437692587efabe196ebb119087712086cc304289ec1c684ab4efbdece115a4bd1298b57bf58699a0d672f76f6aa196793b
6
+ metadata.gz: 36a80fb99501720b6dda49b61dac22deefa30b9bfcc46b7c00c7ec293dc0de4400dcdb4ac3b35d46d3d6722d8bf79a5e7ace2481c3c91ad1b0310900135aa802
7
+ data.tar.gz: 3d3c7f3eea41454551f3fa21dd8721da779eaa676f97520946fcb8294e20c3bdddb88fd613bfd43cdf0edaf434583c8c93ddc3ad099fddc8e8179598c70b9e92
@@ -14,6 +14,7 @@ rvm:
14
14
  - 2.6.5
15
15
  - 2.7.0
16
16
  - ruby-head
17
+ - truffleruby-head
17
18
  gemfile:
18
19
  - gemfiles/rails42.gemfile
19
20
  - gemfiles/rails50.gemfile
@@ -96,3 +97,15 @@ matrix:
96
97
  gemfile: gemfiles/rails42_boc.gemfile
97
98
  - rvm: ruby-head
98
99
  gemfile: gemfiles/rails42_haml.gemfile
100
+ - rvm: truffleruby-head
101
+ gemfile: gemfiles/rails42_boc.gemfile
102
+ - rvm: truffleruby-head
103
+ gemfile: gemfiles/rails50_boc.gemfile
104
+ - rvm: truffleruby-head
105
+ gemfile: gemfiles/rails51_boc.gemfile
106
+ - rvm: truffleruby-head
107
+ gemfile: gemfiles/rails52_boc.gemfile
108
+ - rvm: truffleruby-head
109
+ gemfile: gemfiles/rails60_boc.gemfile
110
+ - rvm: truffleruby-head
111
+ gemfile: gemfiles/rack_boc.gemfile
@@ -4,8 +4,18 @@ module BetterErrors
4
4
  attr_reader :exception, :message, :backtrace
5
5
 
6
6
  def initialize(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`.
7
+ if exception.class.name == "ActionView::Template::Error" && exception.respond_to?(:cause)
8
+ # Rails 6+ exceptions of this type wrap the "real" exception, and the real exception
9
+ # is actually more useful than the ActionView-provided wrapper. Once Better Errors
10
+ # supports showing all exceptions in the cause stack, this should go away. Or perhaps
11
+ # this can be changed to provide guidance by showing the second error in the cause stack
12
+ # under this condition.
13
+ exception = exception.cause if exception.cause
14
+ elsif exception.respond_to?(:original_exception) && exception.original_exception
15
+ # This supports some specific Rails exceptions, and this is not intended to act the same as
16
+ # the Ruby's {Exception#cause}.
17
+ # It's possible this should only support ActionView::Template::Error, but by not changing
18
+ # this we're preserving longstanding behavior of Better Errors with Rails < 6.
9
19
  exception = exception.original_exception
10
20
  end
11
21
 
@@ -57,10 +67,6 @@ module BetterErrors
57
67
 
58
68
  def massage_syntax_error
59
69
  case exception.class.to_s
60
- when "ActionView::Template::Error"
61
- if exception.respond_to?(:file_name) && exception.respond_to?(:line_number)
62
- backtrace.unshift(StackFrame.new(exception.file_name, exception.line_number.to_i, "view template"))
63
- end
64
70
  when "Haml::SyntaxError", "Sprockets::Coffeelint::Error"
65
71
  if /\A(.+?):(\d+)/ =~ exception.backtrace.first
66
72
  backtrace.unshift(StackFrame.new($1, $2.to_i, ""))
@@ -1,3 +1,3 @@
1
1
  module BetterErrors
2
- VERSION = "2.8.0"
2
+ VERSION = "2.8.1"
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.8.0
4
+ version: 2.8.1
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-09-15 00:00:00.000000000 Z
11
+ date: 2020-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake