letsencrypt / letsencrypt/boulder

wfe: change error-handling paradigm

Open
#4,980 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
5.8k
Forks
649
Avg merge
3d 23h
Merged PRs (30d)
24

Description

Right now our HTTP handlers in wfe and wfe2 follow the API used by net/http: To return an error, you have to set the status code and write the error body, then return. This leaves a possibility of forgetting to write the return. We should write wrappers such that our handlers return error instead, and the wrappers handle setting the status code and sending the error body. This would reduce that chance of such mistakes. Thanks to @yuriks for the idea.

Contributor guide

Open the contributing guide

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

Start by reading the HTTP handlers in wfe and wfe2 and comparing their current net/http error handling. Define how handlers returning error should be wrapped, including status-code and error-body behavior. Done means both handler areas consistently use the new return-error paradigm without relying on callers to write the response.

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
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.