adobe / reactor-uploader

Command line tool for uploading Adobe Experience Platform Tags extensions.
Apache License 2.0
9 stars 11 forks source link

DTM-13285 Show native JS errors details. #23

Closed dompuiu closed 4 years ago

dompuiu commented 5 years ago

jwt-auth throws native errors or objects containing the error_description property for errors thrown by the API. We need to capture both types.

Aaronius commented 5 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.

dompuiu commented 5 years ago

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].

Aaronius commented 5 years ago

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?

dompuiu commented 5 years ago

That is why I have written a special test for this case. If you put ${e}, it will throw an error.

dompuiu commented 5 years ago

Opened an issue on jwt-auth: https://github.com/adobe/jwt-auth/issues/8.

Aaronius commented 5 years ago

Me too https://github.com/adobe/jwt-auth/issues/9. 🤷‍♂

Aaronius commented 5 years ago

This PR needs to get updated with the latest changes from jwt-auth.

dompuiu commented 4 years ago

Since I initiated this PR, it seems I cannot submit a review with approve. Probably @Aaronius can.

Aaronius commented 4 years ago

Thanks @brenthosie!

Aaronius commented 4 years ago

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?

Aaronius commented 4 years ago

Published in v4.1.1.