Idiomatic error handling for requests #18

Open
opened 2022-08-25 21:48:38 +02:00 by orblivion · 0 comments
orblivion commented 2022-08-25 21:48:38 +02:00 (Migrated from github.com)

Right now I have a weird thing where I have a function that checks for auth errors, and replies to the request with a json error and otherwise returns a token. I probably want to return an error, but I didn't want to have a lot of boilerplate in the handler.

I could probably create a new error type that automatically becomes a json. And a different variant for 500s, since the error should not be output to the user, but rather logs instead (as I do now but in a less idiomatic way).

Right now I have a weird thing where I have a function that checks for auth errors, and replies to the request with a json error and otherwise returns a token. I probably want to return an error, but I didn't want to have a lot of boilerplate in the handler. I could probably create a new error type that automatically becomes a json. And a different variant for 500s, since the error should not be output to the user, but rather logs instead (as I do now but in a less idiomatic way).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: LBRYCommunity/wallet-sync-server#18
No description provided.