lbryio / lbryio/wallet-sync-server

Idiomatic error handling for requests

Open
#18 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
1
Forks
2
PR merge metrics
No merged PRs in 30d

Description

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).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file, test, or entry point is named. Start by locating the request handler and its auth-checking function, then trace how token success, JSON auth errors, and internal 500 errors are currently handled and logged. Done means the handling is idiomatic, avoids repeated handler boilerplate, returns appropriate JSON for user-facing errors, and keeps internal errors out of responses.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, backend
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.