This repository has been archived by the owner on Feb 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
HTTP call done twice #44
Labels
Comments
Let the component handle the error on their own is pain in the ass IMO, but I think a |
Anyhow, who is responsible for catching your exception today? And (genuinely) how is the exception catchable? given the asynchronous stuff. |
IMO, it should be the service |
This exception is wrong anyway :
|
OK. |
I would like to see both exception, catch any of them before the call and then catch this one if there is a problem without making two calls ;) |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The
APIService::getCollectionByUrl()
trigger the http call twice (to be clear, I’m not talking about the OPTIONS http method here). This is due to thequery.subscribe
used to handle an error.https://github.com/coopTilleuls/hm-admin/blob/master/src/app/hm-admin/services/api/api.service.ts#L36
My opinion is we should not interfere with the Rxjs observable error workflow and let the error live is nasty little life until someone who knows how to handle it catch it up.
Still in my opinion and arguably, the error should almost never be catched by the APIService. The error should bubble up to the final subscriber.
Anyhow, I bet that the error workflow is broken here since the exception is thrown asynchronuously and therefore is hardly catchable.
In case that my point was not clear: My fix proposition is to remove this subscription purely and simply ;)
The text was updated successfully, but these errors were encountered: