Sha256: 3802d52b28495ce89f188c18a7a99cf047a78132f1fd13ae433d6055ddc0e00e
Contents?: true
Size: 624 Bytes
Versions: 13
Compression:
Stored size: 624 Bytes
Contents
module Chanko class ExceptionHandler def self.handle(*args) new(*args).handle end attr_reader :exception, :unit def initialize(exception, unit = nil) @exception = exception @unit = unit end def handle if propagated? raise exception else log raise exception if raised? end end private def propagated? Config.propagated_errors.any? {|klass| exception.is_a?(klass) } end def raised? unit.try(:raise_error?) || Config.raise_error end def log Logger.debug(exception) end end end
Version data entries
13 entries across 13 versions & 1 rubygems