An exception handler: given the request context and the raised error, returnSome(response) to handle it or None to defer to the next handler. Theexplicit MoonBit form of FastAPI's @app.exception_handler(ExcType) — theNone case stands in for "this handler isn't registered for that type".
An HTTP error a handler can raise to short-circuit with a status and body(← FastAPI's HTTPException). detail is any JSON (a string is the commoncase); headers are added to the response (e.g. a WWW-Authenticatechallenge). Caught by the app and mapped to a response.
Build an HttpException with a string detail — the common case — andoptional extra headers. raise http_error(404, "Item not found") readslike FastAPI's raise HTTPException(404, "Item not found").