server/app_error_handler.ts

The assembled app's onError — what a throw that escapes every route catch answers.

Route handlers and the RPC dispatcher map their own throws (http/route_spec.ts, actions/perform_action.ts); what reaches here is a throw from middleware — above all the credential legs, whose failed read ends the request rather than reading as anonymous. Two answers:

  • a failed pool checkout (DbCheckoutError) is the database unavailable: 503 {"error": "service_unavailable"}, the Rust spine's fuz_http::db_unavailable_response (and its CredentialReadFault of the checkout kind);
  • anything else is Hono's default error handler, reproduced byte for byte — an HTTPException's own response, else 500 text/plain; charset=UTF-8 Internal Server Error, the body the Rust CredentialReadFault of the query kind answers with.
view source

Declarations
#

create_app_error_handler
#

server/app_error_handler.ts view source

(log: Logger): ErrorHandler import {create_app_error_handler} from '@fuzdev/fuz_app/server/app_error_handler.js';

Build the app's onError handler (module doc).

log

receives each failed checkout and each unhandled error

type Logger

returns

ErrorHandler

the handler create_app_server registers with app.onError

Depends on
#

Imported by
#