Sha256: add3f7f6a0b48c3c72b56b1e8f858904ef5a5adff955fd84d3c051aef86fbca4
Contents?: true
Size: 974 Bytes
Versions: 6
Compression:
Stored size: 974 Bytes
Contents
class DripDrop class BaseHandler def on_error(&block) @err_cbak = block end def handle_error(exception,*extra) if @err_cbak begin @err_cbak.call(exception,*extra) rescue StandardError => e print_exception(e) end else print_exception(exception) end end def print_exception(exception) if exception.is_a?(Exception) $stderr.write exception.message $stderr.write exception.backtrace.join("\t\n") else $stderr.write "Expected an exception, got: #{exception.inspect}" end end private # Normalize Hash objs and DripDrop::Message objs into DripDrop::Message objs def dd_messagify(message,klass=DripDrop::Message) if message.is_a?(Hash) return klass.from_hash(message) elsif message.is_a?(DripDrop::Message) return message else return message end end end end
Version data entries
6 entries across 6 versions & 1 rubygems