class Runcobo::ErrorHandler

Overview

Turns unhandled exceptions into a response while headers can still change.

The default response matches Crystal's plain 500 Internal Server Error, but keeps the X-Request-Id header set by LogHandler. Pass a block to render an application-specific error body. The block receives a reset response whose status is already 500.

Exceptions raised after headers are sent, and client disconnects, are re-raised so the server closes the interrupted connection.

Included Modules

Defined in:

runcobo/handlers/error_handler.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new #

[View source]
def self.new(&renderer : Renderer) #

[View source]

Instance Method Detail

def call(context) #

[View source]