OpenSlides / OpenSlides/openslides-client

Refactor `http.service.ts` error handling

Open
#3,055 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

clean up
Dominant language
TypeScript
Stars
35
Forks
52
Avg merge
1d 9h
Merged PRs (30d)
52

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in http.service.ts and trace how callers handle its null results, especially the password-reset request. Define the error behavior and snackbar opt-out from the issue, then add coverage for failed responses and the successful null result; done means callers receive failure information without an unwanted snackbar.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.