Processing a bad request

Hi,

I am building a backend service as a part of my app. The service is making an HTTP request to the external service. The external service sometimes responds with a 400 status. I want to process this answer, but after 400 is caught as a response, the service throws an exception. I was trying to use the try/catch block, but then I was unable to get the response (the error variable is empty). Any idea how to solve this?

Hello @Arkadiusz_Kumpin

Try this:

Regards,
Vladimir

1 Like

Tx, I was trying to directly return the error msg. Forgot to check is it available outside of the try method.