diff options
author | Yves Senn <yves.senn@gmail.com> | 2014-03-29 15:41:26 +0100 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2014-03-29 15:41:26 +0100 |
commit | 03bf81a5040f08970fc5d091af38d6e2afc7113c (patch) | |
tree | 7e4b3428255f23239d16b7aa3fca9fd910e998dd /actionpack/lib | |
parent | 0b33c06475e6d8f4e52e3bfc98e2e897a4155bc6 (diff) | |
parent | 6af07c27ae65dfaf0d42a2741544915459efe67a (diff) | |
download | rails-03bf81a5040f08970fc5d091af38d6e2afc7113c.tar.gz rails-03bf81a5040f08970fc5d091af38d6e2afc7113c.tar.bz2 rails-03bf81a5040f08970fc5d091af38d6e2afc7113c.zip |
Merge pull request #13890 from achempion/syntax-error-backtrace
append link to bad code when error type is SyntaxError
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/exception_wrapper.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/exception_wrapper.rb b/actionpack/lib/action_dispatch/middleware/exception_wrapper.rb index 377f05c982..2326bb043a 100644 --- a/actionpack/lib/action_dispatch/middleware/exception_wrapper.rb +++ b/actionpack/lib/action_dispatch/middleware/exception_wrapper.rb @@ -32,6 +32,8 @@ module ActionDispatch def initialize(env, exception) @env = env @exception = original_exception(exception) + + expand_backtrace if exception.is_a?(SyntaxError) || exception.try(:original_exception).try(:is_a?, SyntaxError) end def rescue_template @@ -104,5 +106,11 @@ module ActionDispatch end end end + + def expand_backtrace + @exception.backtrace.unshift( + @exception.to_s.split("\n") + ).flatten! + end end end |