Error response handling in HTTP services
★ 0.0 (0 ratings)30 min0 engineers solved this
Your assignment
This is a small Node.js library for building asynchronous HTTP services. A developer exports a handler that receives the request and response, and returns a value (string, object, buffer, stream, or null) that the library sends automatically. Handlers can throw or reject; the run wrapper catches the failure and passes it to sendError, which chooses the HTTP status code, sends the response body, and writes a log line for the operator. Helpers such as send, createError, buffer, text and json are used inside handlers to build responses and parse request bodies. Errors created with createError carry a statusCode that the library uses for the response.
What the team is seeing
Some requests to the service fail with a server error, and the operator's logs show nothing useful about what went wrong. The failure is hard to diagnose because the log entry for these failures is empty.
Acceptance checks 1
- Check 1
Discussion is locked — log in and complete this problem to join the discussion and rate your experience.
