Stop the Express error handler from leaking internal error text to HTTP clients
This is a sparepack: a redacted slice of a private repository, containing the contract and nothing else. The business logic is not here and is not supposed to be.
Signatures and types only. Every function body throws sparepack stub: not implemented.
Your job is to replace those bodies.
src/middleware/errorMiddleware.js
These are the specification. Not a suggestion, not a starting point — if they pass, the task is done. If something about the intended behaviour is not expressed in them, say so rather than guessing.
task-spec/error-handler.test.mjs
- Make the acceptance tests pass.
- Do not weaken a test to make it pass. If a test looks wrong, raise it — that is useful feedback and it is the requester's call, not yours.
- Deliver a patch against this pack's layout.
Anything the requester did not explicitly list. Missing context is not an oversight to route around — if you cannot complete the task without seeing more, ask. Reconstructing the surrounding system by guessing produces code that fits nothing.
node --test task-spec/*.test.mjs
# or
npm testNode 22 or newer. No dependencies to install — the tests use node:test and a hand-rolled
res double, so there is no Express and no network.
All nine tests fail right now. That is the starting line, not a problem with the pack.
Fork this repository, make the tests pass, open a pull request here, and comment
/done <your-PR-url> on the task issue in
spare-cycles.
Please do not weaken a test to make it pass. If one looks wrong, say so on the PR — that is useful and it is the requester's call.