Currently I have some problems regarding handling errors after calling httpClientLib.request({}). Currently if I am trying to connect to non existing service(just for example) I am getting ConnectionRefused error, but it returned not like httpClientLib.request({}) response, but handled in default error.js file. Is it possible to get one response endpoint?
Yeah, I mean handling of all responses from httpClientLib.request. Yes I have tried, but in case of ConnectionRefused error it goes to error handler - error.js.
Seems to be it works in all cases besides the case it it falls somewhere inside jax-rs code, and than it goes to error.js handler. At least it is my vision, but not sure about that =).
I see that when a timeout occurs, then http.request throws an exception. When an exception occurs it will automatically trigger the error page to show. But if you try/catch around the block it will be controlled by you. Like this:
Strange, try-catch was the very first way how I have tried to do that, and it worked in the same way(went to error.js).
But I have tried to do it one more time just to be 100% sure that it’s not working, and it started to work. Seems to be I shouldn’t work late and create posts especially. Thank you for help.
If I don’t enclose httpClientLib.request in a try catch block, I get:
java.net.ConnectException: Connection refused (java.lang.RuntimeException)```
If I ```catch(e)```, then e is undefined.
Which makes it kinda difficult to handle various exceptions differently...
Like this:
https://www.safaribooksonline.com/library/view/javascript-the-definitive/9781449393854/ch11s06.html
https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Statements/try...catch