Skip to content

Commit

Permalink
Add smarts to backtrace detection
Browse files Browse the repository at this point in the history
  • Loading branch information
hopsoft committed Jan 4, 2024
1 parent a22144a commit 8cf3920
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/turbo_boost/commands/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ def prevent_controller_action(error: nil)
when TurboBoost::Commands::AbortError
render_response status: 299, headers: {"TurboBoost-Abort": true}
else
location = error.backtrace.first.to_s[/[^\/]+\.rb:\d+/i]
backtrace = error.cause&.backtrace if error.is_a?(TurboBoost::Commands::PerformError)
backtrace ||= error.backtrace || []
location = backtrace.first&.to_s&.[](/[^\/]+\.rb:\d+/i)
render_response status: :internal_server_error,
headers: {"TurboBoost-Error": true, "TurboBoost-Error-Info": "#{location}; #{error.message}"}
append_error_to_response error
Expand Down

0 comments on commit 8cf3920

Please sign in to comment.