Sha256: a8a1145b3fb65c0f36dce81c590589d652aaf01950b4eb649cf53caa20eb241d

Contents?: true

Size: 390 Bytes

Versions: 2

Compression:

Stored size: 390 Bytes

Contents

# exceptions.rb

module Ruby2D
  class Error < StandardError
    def colorize(msg, c); "\e[#{c}m#{msg}\e[0m" end
    def error(msg); colorize(msg, '4;31') end
    def bold(msg); colorize(msg, '1') end
    
    def initialize(msg)
      super(msg)
      puts error("\nRuby 2D Error:") << " " << msg
      puts bold("Occurred in:")
      puts bold("  " + caller.last), "\n"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby2d-0.2.1 lib/ruby2d/exceptions.rb
ruby2d-0.2.0 lib/ruby2d/exceptions.rb