Sha256: 470942eba145b42bb92800501fc62366a37315b4b0f8cfd9ade3a6ae8b62edcd
Contents?: true
Size: 790 Bytes
Versions: 1
Compression:
Stored size: 790 Bytes
Contents
module IB # Error handling class Error < RuntimeError end class ArgumentError < ArgumentError end class SymbolError < ArgumentError end class LoadError < LoadError end end # module IB # Patching Object with universally accessible top level error method. # The method is used throughout the lib instead of plainly raising exceptions. # This allows lib user to easily inject user-specific error handling into the lib # by just replacing Object#error method. def error message, type=:standard, backtrace=nil e = case type when :standard IB::Error.new message when :args IB::ArgumentError.new message when :symbol IB::SymbolError.new message when :load IB::LoadError.new message end e.set_backtrace(backtrace) if backtrace raise e end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ib-ruby-0.8.5 | lib/ib/errors.rb |