EventSource icon indicating copy to clipboard operation
EventSource copied to clipboard

Error status propagation

Open hghammoud opened this issue 7 years ago • 7 comments

  1. If the server is down the preflight generated a ERR_CONNECTION_REFUSED can you please propagate it? so that we can handle it on the app level?
  2. Can you please add the status code inside the error event? currently i have to catch the zone error and check if the message contains 401 ou other code. It can we easier if you propagate the error code.

Thank you

hghammoud avatar Oct 10 '18 11:10 hghammoud

Hi, I just create a branch with a fix. Could you try it ? Error are now propagated on onerror listener with the status code

sguiheux avatar Oct 18 '18 09:10 sguiheux

Thank you. I ll be testing it tonight and giving you a feedback on it.

hghammoud avatar Oct 18 '18 09:10 hghammoud

If your feedback is positive, i will relesea a new version

sguiheux avatar Oct 18 '18 13:10 sguiheux

So for the HTTP.status code it is being propagated. All is good. There is still one case where the server is unavailable the OPTIONS (preflight) gives a net::ERR_CONNECTION_REFUSED.

If you can catch this with a try catch around the xhr and propagate it as a 503.

There are more error responses cases that as much less common but you can just add the message of the error in the error event.

https://stackoverflow.com/questions/28556398/how-to-catch-neterr-connection-refused

hghammoud avatar Oct 19 '18 06:10 hghammoud

Any news on the next release? I would like to integrated before my next release myself ;) Thank you again

hghammoud avatar Oct 20 '18 08:10 hghammoud

new release done, but COONECTION_REFUSED is not inside.

sguiheux avatar Oct 21 '18 07:10 sguiheux

Noted. If you have the time for the other feature it would be awesome. Thank you again for you reactivity.

hghammoud avatar Oct 21 '18 15:10 hghammoud