Skip to content

Gracefully handle exceptions

Aboobacker MK requested to merge gracefully_handle_content_parsing into master

Rails does has builtin rescue mechanism at middleware level called ActionDispatch::ShowExceptions. This wasn't functioning properly since we introduced Gitlab::Middleware::HandleMalformedStrings as it was raising exception before ActionDispatch::ShowExceptions. Fix here is to move the ActionDispatch::ShowExceptions up in the middleware stack.

This seems to be a regression from !112909 (merged)

Context: gitlab-com/gl-infra/production#16421 (comment 1595995965)

How to set up and validate locally

Run the following command, and ensure that it returns 400, not 500 error

 curl -v --request POST https://gdk.test:3000 --data '{"in{valid_js{on"}' --header "Content-Type: application/json"

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Aboobacker MK

Merge request reports

Loading