set controller#action on a controller exception
closes: FOO-1157 The x-canvas-meta header is set on `after_action :set_response_headers` app/controllers/application_controller.rb#81 (ish). The header is not set on an exception This will provide more context in splunk search. ``` index="canvas_iad" source="app/canvas/prod/*/apache2/nomnom" http_request!=*pandata_events_token* vhost!=*elb* vhost="browardschools.instructure.com" http_status=500 ``` Test plan a) jenkins pass Change-Id: I2ee19afb909fa8efb9c5a5bd9eec3136920d0234 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/251512 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Cody Cutrer <cody@instructure.com> Product-Review: Cody Cutrer <cody@instructure.com> QA-Review: Natarajan Santhosh <snatarajan@instructure.com>
This commit is contained in:
parent
d123b00089
commit
29621bcff5
|
@ -1494,6 +1494,10 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
# analogous to rescue_action_without_handler from ActionPack 2.3
|
||||
def rescue_exception(exception)
|
||||
# On exception `after_action :set_response_headers` is not called.
|
||||
# This causes controller#action from not being set on x-canvas-meta header.
|
||||
set_response_headers
|
||||
|
||||
if config.consider_all_requests_local
|
||||
rescue_action_locally(exception)
|
||||
else
|
||||
|
|
|
@ -73,6 +73,15 @@ describe "site-wide" do
|
|||
expect(response[x_canvas_meta]).to match(%r{o=courses;n=show;})
|
||||
end
|
||||
|
||||
it "should set controller#action information in API requests on 500" do
|
||||
course_with_teacher_logged_in
|
||||
allow_any_instance_of(CoursesController).to receive(:index).and_raise(ArgumentError)
|
||||
get "/api/v1/courses"
|
||||
|
||||
assert_status(500)
|
||||
expect(response[x_canvas_meta]).to match(%r{o=courses;n=index;})
|
||||
end
|
||||
|
||||
it "should set page view information in user requests" do
|
||||
course_with_teacher_logged_in
|
||||
Setting.set('enable_page_views', 'db')
|
||||
|
|
Loading…
Reference in New Issue