matrix-org / dendrite

Dendrite is a second-generation Matrix homeserver written in Go!
https://matrix-org.github.io/dendrite/
Apache License 2.0
5.66k stars 664 forks source link

Improve error handling #640

Closed babolivier closed 4 years ago

babolivier commented 5 years ago
Cnly commented 5 years ago

Note that some places in gomatrixserverlib are already using the NotAllowed error, but not sure if Dendrite has made full use of this distinguishment yet.

ptman commented 4 years ago

I've found this a nice pattern for simple errors. Much nicer than var ErrFooBar = errors.New(...): https://dave.cheney.net/2016/04/07/constant-errors

shyam-patel-kira commented 4 years ago

Is anyone working on this issue right now..??

mm-git01 commented 4 years ago

Is anyone working on this issue right now..??

i am

lpar commented 4 years ago

Process errors from gomatrixserverlib and gomatrix correctly so that we don't respond 500 instead of e.g. 403, 404, etc.

Might I suggest adopting RFC 7807?

Also, I've been looking at this problem for my own applications, and came up with lpar/problem as an approach for making it easier to handle.

kegsay commented 4 years ago

We're a lot better at this now, with internal APIs exposing their own error types and GMSL having more thorough error types. There's always room for improvement though so it's hard to know at what point this issue can be closed, so I'm deciding now.