OpenSlides / openslides-client

Webclient for OpenSlides 4+
MIT License
3 stars 31 forks source link

Refactor `http.service.ts` error handling #3055

Open bastianjoel opened 9 months ago

bastianjoel commented 9 months ago

Currently the http.service.ts tries to handle certain backend errors by itself and returns null if it does so.

This is bad because the caller will not be notified properly that a request failed and lacks information about the reasons for that. In case of a password reset which returns null on success it is completely impossible for the caller to determine if the request was successful.

While I think that it is okay to display a snackbar on fail we should change the following things here:

  1. Always throw if an error occurred with all information about the response
  2. Option to disable opening a snackbar on error

Especially 1. needs testing and maybe some considerations.

luisa-beerboom commented 6 months ago

I think #3217 may have at least partially fulfilled the demands of this issue. @bastianjoel can you update/close this accordingly?

jsangmeister commented 6 months ago

From my perspective option 2) is sufficently implemented

bastianjoel commented 5 months ago

I still think not throwing an error should not be the default.

From my perspective option 2) is sufficently implemented

I guess you mean 1)?

bastianjoel commented 5 months ago

I will change this to cleanup because the main part is now at least doable.

jsangmeister commented 5 months ago

I guess you mean 1)?

Well, depending on the perspective. I read the option wrong, but the implemented solution comes close to 2). If you set catchError=false, the error will not be caught and no snackbar will be automatically raised.