class Radbas::CommonErrorHandler

Overview

Responds with Problem Details (RFC 9457) as application/problem+json, e.g.

{"type":"about:blank","title":"Not Found","status":404,"detail":"no collection named orders","instance":"/api/collections/orders"}

instance is the request path without the query string. An HTTPError adds its extension members, see HTTPError#write_extensions.

Server errors are logged. Exceptions other than HTTPError only get type, title, status and instance, unless show_details is set, which adds detail (the message), exception (the class name) and backtrace.

Included Modules

Defined in:

radbas-framework/common_error_handler.cr

Constructors

Instance Method Summary

Instance methods inherited from module Radbas::ErrorHandler

call(context : Context, exception : Exception) : Nil call

Constructor Detail

def self.new(logger : ::Log = Log, show_details : Bool = false) #

[View source]

Instance Method Detail

def call(context : Context, exception : Exception) : Nil #

[View source]