別のキーワード
ライブラリ
- ビルトイン (543)
- bigdecimal (38)
- drb (12)
- e2mmap (78)
- fileutils (24)
- irb (12)
-
json
/ add / exception (24) -
minitest
/ unit (2) -
rubygems
/ commands / lock _ command (12) -
rubygems
/ gem _ openssl (12) -
rubygems
/ security (24) -
rubygems
/ spec _ fetcher (12) - stringio (12)
- timeout (37)
クラス
-
ARGF
. class (10) - BigDecimal (24)
- Exception (136)
- Fiber (18)
-
Gem
:: Commands :: LockCommand (12) -
Gem
:: Security :: Policy (12) -
Gem
:: SpecFetcher (12) - IO (24)
-
MiniTest
:: Unit (1) - SignalException (36)
- StringIO (12)
- Thread (96)
- TracePoint (24)
モジュール
- Exception2MessageMapper (78)
- FileUtils (24)
- Gem (12)
-
Gem
:: Security (12) - IRB (12)
- Kernel (241)
-
MiniTest
:: Assertions (1) - Timeout (21)
キーワード
-
$ -d (12) -
$ DEBUG (12) -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) - == (12)
- BigDecimal (14)
- Complex (14)
- DRbUnknownError (12)
- Fail (12)
- Float (7)
- Integer (7)
-
NEWS for Ruby 3
. 0 . 0 (5) - Raise (12)
- Rational (7)
- Ruby用語集 (12)
- Thread (12)
- abort (24)
-
abort
_ on _ exception (24) -
abort
_ on _ exception= (24) - backtrace (12)
-
backtrace
_ locations (12) - bind (6)
- complain (12)
-
def
_ exception (12) -
ensure
_ ssl _ available (12) -
exception
_ details (1) -
extend
_ object (6) - fail (42)
-
handle
_ interrupt (12) -
irb
_ abort (12) -
json
_ create (12) - logger (12)
- mode (24)
-
net
/ http (12) - new (60)
- puke (1)
- raise (54)
-
raised
_ exception (12) -
read
_ nonblock (34) - remove (12)
-
report
_ on _ exception (18) -
report
_ on _ exception= (18) - rm (12)
-
ruby 1
. 6 feature (12) -
ruby 1
. 8 . 3 feature (12) -
ruby 1
. 8 . 4 feature (12) -
set
_ backtrace (12) - spawn (28)
- system (28)
- timeout (37)
-
to
_ json (12) -
to
_ tty? (8) -
verify
_ gem (12) -
verify
_ trust _ dir (12) -
warn
_ legacy (12) -
write
_ nonblock (12) - yaml (12)
- スレッド (12)
検索結果
先頭5件
-
Exception
. exception(error _ message = nil) -> Exception (27245.0) -
例外オブジェクトを生成して返します。
...返します。
@param error_message エラーメッセージを表す文字列を指定します。このメッセージは
属性 Exception#message の値になり、デフォルトの例外ハンドラで表示されます。
//emlist[例][ruby]{
e = Exception.new("some mes......sage")
p e # => #<Exception: some message>
p e.message # => "some message"
//}
//emlist[例][ruby]{
e = Exception.exception("some message")
p e # => #<Exception: some message>
p e.message # => "some message"
//}... -
Exception
# exception(error _ message) -> Exception (27237.0) -
引数を指定しない場合は self を返します。引数を指定した場合 自身のコピー を生成し Exception#message 属性を error_message にして返します。
...引数を指定した場合 自身のコピー
を生成し Exception#message 属性を error_message にして返します。
Kernel.#raise は、実質的に、例外オブジェクトの exception
メソッドの呼び出しです。
@param error_message エラーメッセージを表す文字......列を指定します。
//emlist[例][ruby]{
begin
# ... # 何か処理
rescue => e
raise e.exception("an error occurs during hogehoge process") # 詳しいエラーメッセージ
end
//}... -
Exception
# exception -> self (27137.0) -
引数を指定しない場合は self を返します。引数を指定した場合 自身のコピー を生成し Exception#message 属性を error_message にして返します。
...引数を指定した場合 自身のコピー
を生成し Exception#message 属性を error_message にして返します。
Kernel.#raise は、実質的に、例外オブジェクトの exception
メソッドの呼び出しです。
@param error_message エラーメッセージを表す文字......列を指定します。
//emlist[例][ruby]{
begin
# ... # 何か処理
rescue => e
raise e.exception("an error occurs during hogehoge process") # 詳しいエラーメッセージ
end
//}... -
Exception
. new(error _ message = nil) -> Exception (12145.0) -
例外オブジェクトを生成して返します。
...返します。
@param error_message エラーメッセージを表す文字列を指定します。このメッセージは
属性 Exception#message の値になり、デフォルトの例外ハンドラで表示されます。
//emlist[例][ruby]{
e = Exception.new("some mes......sage")
p e # => #<Exception: some message>
p e.message # => "some message"
//}
//emlist[例][ruby]{
e = Exception.exception("some message")
p e # => #<Exception: some message>
p e.message # => "some message"
//}... -
Exception2MessageMapper
. def _ exception(klass , exception _ name , message _ format , superklass = StandardError) -> Class (9254.0) -
exception_name という名前の例外クラスを定義します。
...
exception_name という名前の例外クラスを定義します。
@param klass 一階層上となるクラス名を指定します。
@param exception_name 例外クラスの名前をシンボルで指定します。
@param message_format メッセージのフォーマットを指定しま......el.#sprintf のフォーマット文字列と同じ形式を使用できます。
@param superklass 定義する例外クラスのスーパークラスを指定します。
省略すると StandardError を使用します。
@return 定義した例外クラスを返します。... -
Exception2MessageMapper
# def _ exception(exception _ name , message _ format , superclass = StandardError) -> Class (9242.0) -
exception_name という名前の例外クラスを定義します。
...
exception_name という名前の例外クラスを定義します。
@param exception_name 定義する例外クラスの名前をシンボルで指定します。
@param message_format メッセージのフォーマット。
@param superclass 定義する例外のスーパークラスを指定... -
Exception
. json _ create(hash) -> Exception (9107.0) -
JSON のオブジェクトから Ruby のオブジェクトを生成して返します。
...JSON のオブジェクトから Ruby のオブジェクトを生成して返します。
@param hash 適切なキーを持つハッシュを指定します。... -
Exception
# backtrace _ locations -> [Thread :: Backtrace :: Location] (9052.0) -
バックトレース情報を返します。Exception#backtraceに似ていますが、 Thread::Backtrace::Location の配列を返す点が異なります。
...バックトレース情報を返します。Exception#backtraceに似ていますが、
Thread::Backtrace::Location の配列を返す点が異なります。
現状では Exception#set_backtrace によって戻り値が変化する事はあり
ません。
//emlist[例: test.rb][ruby]{
require......def get_exception
return begin
yield
rescue => e
e
end
end
e = get_exception { check_long_month(2) }
p e.backtrace_locations
# => ["test.rb:4:in `check_long_month'", "test.rb:15:in `block in <main>'", "test.rb:9:in `get_exception'", "test.rb:15:in `<main>'"]
//}
@see Exception#backtr... -
Exception
# full _ message(highlight: true , order: :bottom) -> String (9036.0) -
例外の整形された文字列を返します。
...と order は 2.5.1 で追加されました。
@param highlight エスケープシーケンスによる文字装飾をつけるかどうかを指定します。
デフォルト値は Exception.to_tty? の返り値と同じです。
@param order :top か :bottom で指定する必......バックトレースの一番奥がエラーメッセージの上(top)か下(bottom)かを指定します。
デフォルト値は Exception.to_tty? が真なら :bottom で偽なら :top です。
//emlist[例][ruby]{
begin
raise "test"
rescue => e
p e.full_message # => "\e[1m......e[1m)\n\e[m"
$stderr = $stdout
p e.full_message # => "test.rb:2:in `<main>': test (RuntimeError)\n"
$stderr = STDERR
p e.full_message # => "\e[1mTraceback \e[m(most recent call last):\ntest.rb:2:in `<main>': \e[1mtest (\e[4;1mRuntimeError\e[m\e[1m)\n\e[m"
end
//}
@see Exception.to_tty?......による文字装飾がついています。
@param highlight エスケープシーケンスによる文字装飾をつけるかどうかを指定します。
デフォルト値は Exception.to_tty? の返り値と同じです。
@param order :top か :bottom で指定する必... -
Exception
# ==(other) -> bool (9030.0) -
自身と指定された other のクラスが同じであり、 message と backtrace が == メソッドで比較して 等しい場合に true を返します。そうでない場合に false を返します。
...。そうでない場合に false を返します。
@param other 自身と比較したいオブジェクトを指定します。
自身と異なるクラスのオブジェクトを指定した場合は
Exception#exception を実行して変換を試みます。
//emlist[......eturn if Date.new(2000, month, -1).day == 31
raise "#{month} is not long month"
end
def get_exception
return begin
yield
rescue => e
e
end
end
results = [2, 2, 4].map { |e | get_exception { check_long_month(e) } }
p results.map { |e| e.class }
# => [RuntimeError, RuntimeError, Runt...