Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On error in onUserQuery, send back specific HTTP status and errorcode #55

Closed
tak-hntlabs opened this issue Jul 20, 2022 · 2 comments
Closed
Labels
S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect Bugs, crashes, hangs, vulnerabilities, or other reported problems.

Comments

@tak-hntlabs
Copy link
Contributor

Describe the bug
I am building an appservice. The AppService.onGetUsers returns http status 200 in the response message when an exception has occurred this.onUserQuery. Specifically, the onGetUsers method catches the exception, but does this:

// AppService.ts line 232
} catch (e) { res.send({ ... }); }.

This call sends back http status 200. The 200 status is surprising. I had expected 4xx for any exceptions or error because the request is not successful. Consequently, on the dendrite server, the rest of the logic mistakenly assumes the user query succeeded and eventually runs into other issues.

To Reproduce
Dev repro:

  1. Set up Dendrite server + appservice.
  2. Throw an exception in the implementation of onUserQuery.

Expected behavior
The catch block should return a 4xx status.

@Half-Shot Half-Shot added S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect Bugs, crashes, hangs, vulnerabilities, or other reported problems. labels Jul 20, 2022
@Half-Shot
Copy link
Contributor

Marking as a defect because we should be handling errors properly.

@Half-Shot
Copy link
Contributor

Fixed by #422. Thank you @tak-hntlabs !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect Bugs, crashes, hangs, vulnerabilities, or other reported problems.
Projects
None yet
Development

No branches or pull requests

2 participants