Exception: UncaughtThrowError

Inherits:
ArgumentError
  • Object
show all
Defined in:
mrbgems/mruby-catch/mrblib/catch.rb

Overview

Exception raised when a throw is executed without a corresponding catch. This error contains the tag and value that were thrown.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tag, value) ⇒ UncaughtThrowError

call-seq:

UncaughtThrowError.new(tag, value) -> exception

Creates a new UncaughtThrowError with the given tag and value. The tag is the symbol or object that was thrown, and value is the associated value.

error = UncaughtThrowError.new(:done, "finished")
error.tag     #=> :done
error.value   #=> "finished"
error.message #=> "uncaught throw :done"


24
25
26
27
28
# File 'mrbgems/mruby-catch/mrblib/catch.rb', line 24

def initialize(tag, value)
  @tag = tag
  @value = value
  super("uncaught throw #{tag.inspect}")
end

Instance Attribute Details

#tagObject (readonly)

The tag that was thrown



7
8
9
# File 'mrbgems/mruby-catch/mrblib/catch.rb', line 7

def tag
  @tag
end

#valueObject (readonly)

The value that was thrown with the tag



9
10
11
# File 'mrbgems/mruby-catch/mrblib/catch.rb', line 9

def value
  @value
end