Catch unhandled exception
Autorization by Entitlments service (AWS) returns unhandled exception which returns an HTTP code 503 instead of 401 when data-partition-id
is set to string that can't be parsed by StringURL normalizer function.
Sernaio:
-
If data-partition-id as "invalid_value" with quotations, the API returns the following. { "code": 500, "reason": "Access denied", "message": "An unknown error has occurred" }
-
If data-partition-id as invalid_value with OUT quotations, the API returns the following. { "code": 401, "reason": "Access denied", "message": "Cannot authorize user in requested partition" }
in Both cases the input validation is being executed. However due to a corner case bug, the first senario returns an HTTP Code 500 which might be confusing.
This PR is to hanlde the exception and return a proper 4XX HTTP code when validation fails.