module Onyx::HTTP::Middleware::Rescuer(T)

Overview

Rescues T. Firstly calls #handle to handle the error (e.g. log it). Calls #before_next_handler and then the #next_handler.

See Rescuer::Standard and Rescuer::Silent.

Included Modules

Direct including types

Defined in:

onyx-http/middleware/rescuer.cr
onyx-http/middleware/rescuer/silent.cr
onyx-http/middleware/rescuer/error.cr
onyx-http/middleware/rescuer/standard.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(next_handler : ::HTTP::Handler) #

Initialize with a next_handler to call when a error is rescued.


[View source]

Instance Method Detail

def before_next_handler(context : HTTP::Server::Context, error : T) #

Called just before the #next_handler is called. It does context.response.error = error by default.


[View source]
abstract def handle(context : HTTP::Server::Context, error : T) #

Process the error before further handling. A good example is logging it.


[View source]
def next_handler : ::HTTP::Handler #

A handler to call when a error is rescued.


[View source]
def next_handler=(next_handler : ::HTTP::Handler) #

A handler to call when a error is rescued.


[View source]