mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #42422 from Shopify/as-time-with-zone-no-method-error
Improve `AS::TimeWithZone` error message on `NoMethodError`
This commit is contained in:
commit
4493db2109
2 changed files with 2 additions and 2 deletions
|
@ -542,7 +542,7 @@ module ActiveSupport
|
|||
def method_missing(sym, *args, &block)
|
||||
wrap_with_time_zone time.__send__(sym, *args, &block)
|
||||
rescue NoMethodError => e
|
||||
raise e, e.message.sub(time.inspect, inspect), e.backtrace
|
||||
raise e, e.message.sub(time.inspect, inspect).sub("Time", "ActiveSupport::TimeWithZone"), e.backtrace
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -1078,7 +1078,7 @@ class TimeWithZoneTest < ActiveSupport::TestCase
|
|||
e = assert_raises(NoMethodError) {
|
||||
@twz.this_method_does_not_exist
|
||||
}
|
||||
assert_equal "undefined method `this_method_does_not_exist' for Fri, 31 Dec 1999 19:00:00.000000000 EST -05:00:Time", e.message
|
||||
assert_equal "undefined method `this_method_does_not_exist' for Fri, 31 Dec 1999 19:00:00.000000000 EST -05:00:ActiveSupport::TimeWithZone", e.message
|
||||
assert_no_match "rescue", e.backtrace.first
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue