In Cloud Shell scenarios, an error response would have the form of {"error": {...}}, where the actual error info was in a JSON within the main JSON. This lead to our JSON parser throwing an exception when it tried to parse the sub-JSON like a primitive value.
This PR fixes that issue with a new method and small nested class. If the "error" field of the response is a JSON instead of a String, the JSON parsing package we use will convert it to and ErrorField field object that will then have the actual error info we're looking for. If the "error" field of the response isn't a JSON, then the existing error field will be populated and that new method won't get called.
Fixes the issue described in https://github.com/AzureAD/microsoft-authentication-library-for-java/issues/744
In Cloud Shell scenarios, an error response would have the form of
{"error": {...}}
, where the actual error info was in a JSON within the main JSON. This lead to our JSON parser throwing an exception when it tried to parse the sub-JSON like a primitive value.This PR fixes that issue with a new method and small nested class. If the
"error"
field of the response is a JSON instead of a String, the JSON parsing package we use will convert it to andErrorField
field object that will then have the actual error info we're looking for. If the"error"
field of the response isn't a JSON, then the existingerror
field will be populated and that new method won't get called.