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.

Functions

f
errorMiddleware(
ctx: Context,
next: Next
): Promise<void>

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.