Closed dompuiu closed 4 years ago
For the errors thrown by their API, why doesn't their toString
output whatever their error_description
is? It sounds like something they might need to fix on their end.
The APIs will return a JSON that once it is parsed it will be transformed in an object. If we use ${e}
, the message will look like Error retrieving access token. [object Object]
.
My take is they shouldn't be throwing the API result directly, but instead should be throwing something with a proper toString
that provides a message. Anyway, can you write a comment in the code that explains why ${e.error_description || e}
isn't just ${e}
for the next engineer that comes along?
That is why I have written a special test for this case. If you put ${e}
, it will throw an error.
Opened an issue on jwt-auth
: https://github.com/adobe/jwt-auth/issues/8.
Me too https://github.com/adobe/jwt-auth/issues/9. 🤷♂
This PR needs to get updated with the latest changes from jwt-auth.
Since I initiated this PR, it seems I cannot submit a review with approve. Probably @Aaronius can.
Thanks @brenthosie!
We have the same issue in the releaser (https://github.com/adobe/reactor-releaser/blob/master/bin/getIntegrationAccessToken.js#L57). @brenthosie do you want to take that as well?
Published in v4.1.1.
jwt-auth
throws native errors or objects containing theerror_description
property for errors thrown by the API. We need to capture both types.