ライブラリ
- ビルトイン (216)
- e2mmap (12)
- getoptlong (11)
- logger (44)
- optparse (22)
-
rubygems
/ remote _ fetcher (11) - socket (44)
-
syslog
/ logger (11) - timeout (16)
-
win32
/ registry (11)
クラス
- Exception (44)
- Fiber (15)
- FrozenError (5)
-
Gem
:: RemoteFetcher :: FetchError (11) - GetoptLong (11)
- KeyError (19)
- Logger (44)
- NameError (17)
- NoMethodError (17)
-
OptionParser
:: ParseError (22) - Socket (22)
-
Syslog
:: Logger (11) - SystemCallError (11)
- SystemExit (11)
- Thread (11)
-
Win32
:: Registry :: Error (11)
モジュール
- Exception2MessageMapper (12)
- Kernel (66)
-
Socket
:: Constants (22) - Timeout (16)
キーワード
- FormatMessageA (11)
-
IP
_ RECVERR (22) -
MSG
_ ERRQUEUE (22) -
NEWS for Ruby 3
. 0 . 0 (4) - add (22)
-
def
_ exception (12) - errno (11)
- exception (33)
- fail (33)
- log (22)
- logger (11)
- new (84)
- raise (59)
- receiver (7)
-
ruby 1
. 6 feature (11) -
ruby 1
. 8 . 3 feature (11) -
ruby 1
. 8 . 4 feature (11) - timeout (16)
-
to
_ s (11) - 制御構造 (11)
検索結果
先頭5件
- OptionParser
:: ParseError # message -> String - Syslog
:: Logger # error(message = nil , &block) -> true - Exception2MessageMapper
# def _ exception(exception _ name , message _ format , superclass = StandardError) -> Class - Exception2MessageMapper
. def _ exception(klass , exception _ name , message _ format , superklass = StandardError) -> Class - GetoptLong
# error _ message -> String | nil
-
OptionParser
:: ParseError # message -> String (24201.0) -
標準エラーに出力するメッセージを返します。
標準エラーに出力するメッセージを返します。
@return 文字列を返します。 -
Syslog
:: Logger # error(message = nil , &block) -> true (18336.0) -
ERROR 情報を出力します。syslog の warning の情報として記録されます。
...
ERROR 情報を出力します。syslog の warning の情報として記録されます。
ブロックを与えなかった場合は、message をメッセージとしてログを出力します。
ブロックを与えた場合は、ブロックを評価した結果をメッセージとして......ログを出力します。
引数とブロックを同時に与えた場合は、message をメッセージとしてログを出
力します(ブロックは評価されません)。
@see Syslog::Logger::LEVEL_MAP, Logger#error... -
Exception2MessageMapper
# def _ exception(exception _ name , message _ format , superclass = StandardError) -> Class (12407.0) -
exception_name という名前の例外クラスを定義します。
...exception_name という名前の例外クラスを定義します。
@param exception_name 定義する例外クラスの名前をシンボルで指定します。
@param message_format メッセージのフォーマット。
@param superclass 定義する例外のスーパークラスを指定......します。
省略すると StandardError を使用します。... -
Exception2MessageMapper
. def _ exception(klass , exception _ name , message _ format , superklass = StandardError) -> Class (12407.0) -
exception_name という名前の例外クラスを定義します。
...exception_name という名前の例外クラスを定義します。
@param klass 一階層上となるクラス名を指定します。
@param exception_name 例外クラスの名前をシンボルで指定します。
@param message_format メッセージのフォーマットを指定しま......す。
Kernel.#sprintf のフォーマット文字列と同じ形式を使用できます。
@param superklass 定義する例外クラスのスーパークラスを指定します。
省略すると StandardError を使用します。
@return 定義した例... -
GetoptLong
# error _ message -> String | nil (12302.0) -
現在のエラーのエラーメッセージを返します。エラーが発生していな ければ、nil を返します。
...現在のエラーのエラーメッセージを返します。エラーが発生していな
ければ、nil を返します。... -
Win32
:: Registry :: Error :: FormatMessageA (12100.0) -
@todo
@todo -
Exception
. exception(error _ message = nil) -> Exception (9470.0) -
例外オブジェクトを生成して返します。
...@param error_message エラーメッセージを表す文字列を指定します。このメッセージは
属性 Exception#message の値になり、デフォルトの例外ハンドラで表示されます。
//emlist[例][ruby]{
e = Exception.new("some message")
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 (9468.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
//}... -
Timeout
. # timeout(sec , exception _ class , message) {|i| . . . } -> object (9261.0) -
ブロックを sec 秒の期限付きで実行します。 ブロックの実行時間が制限を過ぎたときは例外 Timeout::Error が発生します。
...を過ぎたときは例外
Timeout::Error が発生します。
exception_class を指定した場合には Timeout::Error の代わりに
その例外が発生します。
ブロックパラメータ i は sec がはいります。
また sec が 0 もしくは nil のときは制限時間なし......exception_class タイムアウトした時、発生させる例外を指定します.
@param message エラーメッセージを指定します.省略した場合は
"execution expired" になります.
例 長い計算のタイムアウト
require 'timeout'
def calc_pi(min)......+ y**2 < 1.0 ? min[0] += 1 : min[1] += 1
end
end
t = 5
min = [ 0, 0]
begin
Timeout.timeout(t){
calc_pi(min)
}
rescue Timeout::Error
puts "timeout"
end
printf "%d: pi = %f\n", min[0] + min[1], min[0]*4.0/(min[0]+min[1])
#例
#=> 417519: pi = 3.141443
例... -
Exception
# exception -> self (9168.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
//}... -
Timeout
. # timeout(sec , exception _ class = nil) {|i| . . . } -> object (9161.0) -
ブロックを sec 秒の期限付きで実行します。 ブロックの実行時間が制限を過ぎたときは例外 Timeout::Error が発生します。
...を過ぎたときは例外
Timeout::Error が発生します。
exception_class を指定した場合には Timeout::Error の代わりに
その例外が発生します。
ブロックパラメータ i は sec がはいります。
また sec が 0 もしくは nil のときは制限時間なし......exception_class タイムアウトした時、発生させる例外を指定します.
@param message エラーメッセージを指定します.省略した場合は
"execution expired" になります.
例 長い計算のタイムアウト
require 'timeout'
def calc_pi(min)......+ y**2 < 1.0 ? min[0] += 1 : min[1] += 1
end
end
t = 5
min = [ 0, 0]
begin
Timeout.timeout(t){
calc_pi(min)
}
rescue Timeout::Error
puts "timeout"
end
printf "%d: pi = %f\n", min[0] + min[1], min[0]*4.0/(min[0]+min[1])
#例
#=> 417519: pi = 3.141443
例...