概要
Exception#status/success?
詳細
Exception#statusはSystemExitの終了ステータスを返します。
Exception#success?はSystemExitの終了ステータスがtrueかnilの場合に真を返します。
サンプル
コード
# encoding: utf-8 class Hoge def hoge(msg) Hige.new.hige(msg) end end class Hige def hige(msg) exit(99) if msg.nil? msg.upcase exit end end begin Hoge.new.hoge nil rescue SystemExit => e puts e.status puts e.success? end begin Hoge.new.hoge ("hige") rescue SystemExit => e puts e.status puts e.success? end
出力
99 false 0 true