Gracefully handle exceptions
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.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Aboobacker MK