class

HTTP::ErrorHandler

Inherits HTTP::Handler / Reference / Object

A handler that invokes the next handler and, if that next handler raises an exception, returns with a 500 (Internal Server Error) status code.

In verbose mode prints the exception with its backtrace to the response. Otherwise a generic error message is returned to the client.

This handler also logs the exceptions to the specified logger or the logger for the source "http.server" by default.

NOTE: To use ErrorHandler, you must explicitly import it with require "http"

Constructors

new(verbose : Bool = false, log : Log = Log.for("http.server"))
Source

Instance methods

call(context : HTTP::Server::Context) : Nil
Source