class Failure
A wrapper for outputting failure messages, which can include exceptions.
Definitions
def call(subject = nil, *arguments, exception: nil, **options, &block)
The exception must be either the last argument or passed as an option.
Implementation
def call(subject = nil, *arguments, exception: nil, **options, &block)
if exception.nil?
last = arguments.last
if last.is_a?(Exception)
options[:event] = Event::Failure.for(last)
end
else
options[:event] = Event::Failure.for(exception)
end
super(subject, *arguments, **options)
end