summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-catch/mrblib/catch.rb
diff options
context:
space:
mode:
Diffstat (limited to 'mrbgems/mruby-catch/mrblib/catch.rb')
-rw-r--r--mrbgems/mruby-catch/mrblib/catch.rb24
1 files changed, 5 insertions, 19 deletions
diff --git a/mrbgems/mruby-catch/mrblib/catch.rb b/mrbgems/mruby-catch/mrblib/catch.rb
index 68b165c8d..9a60a67a3 100644
--- a/mrbgems/mruby-catch/mrblib/catch.rb
+++ b/mrbgems/mruby-catch/mrblib/catch.rb
@@ -1,22 +1,8 @@
-class ThrowCatchJump < Exception
- attr_reader :_tag, :_val
- def initialize(tag, val)
- @_tag = tag
- @_val = val
+class UncaughtThrowError < ArgumentError
+ attr_reader :tag, :value
+ def initialize(tag, value)
+ @tag = tag
+ @value = value
super("uncaught throw #{tag.inspect}")
end
end
-
-module Kernel
- def catch(tag=Object.new, &block)
- block.call(tag)
- rescue ThrowCatchJump => e
- unless e._tag.equal?(tag)
- raise e
- end
- return e._val
- end
- def throw(tag, val=nil)
- raise ThrowCatchJump.new(tag, val)
- end
-end