summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/ruby2d/exceptions.rb10
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