On this page:

10 Errors🔗

 (require koyo/error) package: koyo-lib

This module exposes an error handling middleware that displays stack traces in the browser in a prettier way than the default web server error handler:


((wrap-errors debug?) handler)  (-> request? can-be-response?)

  debug? : boolean?
  handler : (-> request? can-be-response?)
Wraps handler such that, when debug? is #t, unhandled exceptions are caught, logged to standard error using error-display-handler and formatted for display in the web browser like in the screenshot above.

This parameter holds the procedure that is used to render error pages when the debug? parameter passed to wrap-errors is #f.

The default implementation is completely unstyled and simply states that an error occurred and the user should try again later.