element-hq / element-hq/dendrite
Refactor cross-boundary error handling
- Dominant language
- Go
- Stars
- 965
- Forks
- 101
- PR merge metrics
- No merged PRs in 30d
Description
*This issue was originally created by [**@neilalexander**](https://github.com/neilalexander) at .*
Errors in Dendrite are a mess.
The client API has `jsonerror.MatrixError`, which is nice because those are the things that are returned to clients, although it is maybe misplaced since we also might want to use those in the federation API.
[gomatrix](https://github.com/matrix-org/gomatrix) also has `*gomatrix.HTTPError`, and then in some places we have `roomserverAPI.PerformError`, and in other places we just throw regular opaque errors around. In some API functions we put `PerformError`s into the response struct, in others we just return an `error` from the function itself.
This makes it really difficult to return meaningful clients and other federated servers to errors consistently in any place that an API query is performed.
We should do the work to ensure that if we provide a `jsonerror.MatrixError`, that it is correctly marshalled and unmarshalled across API boundaries and that they make it all the way back to clients/federation endpoints, and tidy up the rest of the mess so that it's consistent and usable.
Contributor guide
Research direction
Start by tracing jsonerror.MatrixError, gomatrix.HTTPError, and roomserverAPI.PerformError through the API query paths and client/federation endpoints. Determine how errors currently cross API boundaries and define consistent marshaling, unmarshaling, and propagation behavior; the work is done when meaningful errors reliably reach clients and federated servers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, backend, backend-api-design
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100