SAP / cloud-sdk-js

Use the SAP Cloud SDK for JavaScript / TypeScript to reduce development effort when building applications on SAP Business Technology Platform that communicate with SAP solutions and services such as SAP S/4HANA Cloud, SAP SuccessFactors, and many others.
Apache License 2.0
161 stars 51 forks source link

JS - retry Resilience - Return the original error #4789

Closed aboccassiniavvale closed 1 week ago

aboccassiniavvale commented 2 weeks ago

Hi experts,

i was trying to implement the "retry" resilience with "executeHttpRequest" method. Following the example of that implementation: image

Testing the error behaviour, I realised that the message that is propagated to the 'catch' is the 'retry' message: 'Request failed with status code 400': image

My question is: is it possible to return the original error message received from the server and which triggered the 'retry' logic?

In this way it would be possible to return a 'talking' (the original) message for logging purposes. Instead, with the 'retry' message ("Request failed with status code 400"), it is impossible to make it clear what the real error was.

Thank you, Alessandro

deekshas8 commented 1 week ago

Hi @aboccassiniavvale ,

Thanks for raising this. I agree this would be an improvement to what is currently returned. I will open a ticket to add more info about the cause of the error.

deekshas8 commented 1 week ago

Hi @aboccassiniavvale ,

We merged a fix for this. It will be available with the next release soon.