Skip to content

Commit e538556

Browse files
committed
fix: Allow recording of error responses
In local development, when an error occurs (i.e. the rails error page is about to be displayed), the response type is not ActionDispatch::Response. The response recieved by the notification listener will instead be a hash.
1 parent 1285bdf commit e538556

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/appmap/handler/rails/request_handler.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ class HTTPServerResponse < AppMap::Event::MethodReturn
7373
class << self
7474
def build_from_invocation(parent_id, return_value, elapsed, response, event: HTTPServerResponse.new)
7575
event ||= HTTPServerResponse.new
76-
event.status = response.status
77-
event.headers = response.headers.dup
76+
event.status = response[:status] || response.status
77+
event.headers = (response[:headers] || response.headers).dup
7878
AppMap::Event::MethodReturn.build_from_invocation parent_id, return_value, nil, elapsed: elapsed, event: event, parameter_schema: true
7979
end
8080
end
@@ -147,7 +147,7 @@ def after_hook(_name, started, finished, _unique_id, payload)
147147
@call_event.id,
148148
return_value,
149149
finished - started,
150-
payload[:response]
150+
payload[:response] || payload
151151
)
152152

153153
AppMap.tracing.record_event return_event

0 commit comments

Comments
 (0)