diff options
| author | Tom Black <[email protected]> | 2015-11-13 00:38:46 -0500 |
|---|---|---|
| committer | Tom Black <[email protected]> | 2015-11-13 00:38:46 -0500 |
| commit | c578541d393dfa1536d564fd71f85f9a62c824c4 (patch) | |
| tree | ff86908b0d7f0f5a397012601ae8fe8d04943ff4 /lib | |
| parent | 92610f26fbeaa7bc3c52dbdca53fc9fec985a313 (diff) | |
| download | ruby2d-c578541d393dfa1536d564fd71f85f9a62c824c4.tar.gz ruby2d-c578541d393dfa1536d564fd71f85f9a62c824c4.zip | |
Cleaner exceptions
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/ruby2d/exceptions.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/ruby2d/exceptions.rb b/lib/ruby2d/exceptions.rb index 6f8416b..9ea90c7 100644 --- a/lib/ruby2d/exceptions.rb +++ b/lib/ruby2d/exceptions.rb @@ -2,11 +2,15 @@ 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 msg - puts "Occurred in:" - puts " " + caller.last, "\n" + puts error("\nRuby 2D Error:") << " " << msg + puts bold("Occurred in:") + puts bold(" " + caller.last), "\n" end end end |
