diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-20 07:55:01 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-20 07:55:01 +0300 |
| commit | f27448bbd4bd1efbe62c37c10c8eb9fe7d629690 (patch) | |
| tree | f08b5ab8dd385148375d025de9d51cf04caf641f /player-android/lib/api | |
| parent | f2f596dc70756402fd27edea69cfd399dd39b183 (diff) | |
Dispatch handleError via HTTPStatuser interface (4a)
handleError previously hard-coded a switch mapping every service sentinel to
its HTTP status. Adding a new sentinel required editing handleError (OCP
violation). Move the status onto the sentinel itself: introduce
api.HTTPStatuser { HTTPStatus() int }, convert the 10 dispatched service
sentinels to a typed *apiError that implements it, and turn handleError into
a thin errors.As-based dispatcher. ErrShareExpired stays a plain sentinel
because it is handled inline by share handlers and never reaches
handleError.
Sentinel messages are aligned with what handleError used to emit (e.g.
ErrForbidden is now "forbidden" instead of "access denied",
ErrAlreadyBootstrapped is "bootstrap already complete") so the dispatcher
can use err.Error() uniformly. Wrapped errors (fmt.Errorf("%w: ...",
ErrNotFound, ...)) keep their context in the response body, which is a
minor improvement over the previous behaviour that collapsed everything to
the bare sentinel message. errors.Is keeps working via pointer equality on
the *apiError sentinels.
Diffstat (limited to 'player-android/lib/api')
0 files changed, 0 insertions, 0 deletions
