Ruby 2.5.0 リファレンスマニュアル > ライブラリ一覧 > 組み込みライブラリ > UncaughtThrowErrorクラス > to_s

instance method UncaughtThrowError#to_s

to_s -> String[permalink][rdoc]

self を tag を含む文字列表現にして返します。



def do_complicated_things
  throw :uncaught_label
end

begin
  do_complicated_things
rescue UncaughtThrowError => ex
  p ex.to_s # => "uncaught throw :uncaught_label"
end