Return status code in errorResponse when server response is not in expected Json format.
Why
If the response is not in expected json format, today we don't catch JsonParsing exception and it bubbles up to the caller.
So the caller get the JsonException instead of the actual server error response.
How
Catching the JSON parsing exception and returning the TokenErrorResponse with error and description set to the statuscode
Testing
Tested with an error scenario, where the response was not in json format.
What
Return status code in errorResponse when server response is not in expected Json format.
Why
If the response is not in expected json format, today we don't catch JsonParsing exception and it bubbles up to the caller. So the caller get the JsonException instead of the actual server error response.
How
Catching the JSON parsing exception and returning the TokenErrorResponse with error and description set to the statuscode
Testing
Tested with an error scenario, where the response was not in json format.