Turns the errors a request's handling throws into APIFailure responses.
main.ts installs it first, so it catches what every later middleware and
route throws.
f
errorMiddleware(): Promise<void>
ctx: Context,
next: Next
Answers an APIException with its status, code and message. Anything
else is logged with its stack and answered with a 500 SERVER_ERROR whose
message gives nothing away.
Usage
import * as mod from "api/middleware/error.ts";