Use @orveth/errors for structured failures. HttpError carries a status code, stable error code, and message. The runtime maps these to JSON responses, including 404 and 405 cases.
errors.ts
import { HttpError } from "@orveth/errors";
app.get("/fail", () => {
throw new HttpError(400, "ORVETH_HTTP_BAD_REQUEST", "Invalid input");
});