Throw
提供: AutoHotkey Wiki
実行制御 | GUI表示 | 演算・変数 | メモリ・DLL操作 | 文字列操作 |
キーボード | マウス | シェル | ウィンドウ | ウィンドウグループ
ステータスバー | コントロール | サウンド | ファイル | INIファイル |
レジストリ | 環境変数 | AutoHotkey | その他 | 設定関係 | オブジェクト
Throw [v1.1.04+][編集]
AHKL エラーの発生を通知する。この信号はTryまたはCatchで受け取ることができる。
Throw [, Expression]
Parameters[編集]
引数名 | 説明 |
---|---|
Expression | Catch の OutputVar に格納する値。
このパラメータは式であるため、以下の例はすべて有効な例: Throw 3
Throw "literal string"
Throw MyVar
Throw i + 1
Throw { what: "Custom error", file: A_LineFile, line: A_LineNumber }
このパラメータは常に式なので、double-derefを実行する場合を除いて変数の参照 [v1.1.05+]: 省略した場合は、Exceptionオブジェクトのデフォルトのメッセージが送られる。 |
Exception(Message [, What, Extra])[編集]
Exceptionオブジェクトを作成します。
If What is omitted, it defaults to the name of the current function or subroutine. Otherwise it can be a string or a negative offset from the top of the call stack. For example, a value of -1 sets Exception.What
to the current function or subroutine and Exception.Line
to the line which called it.
Try BadlyCodedFunc() Catch e MsgBox % "Error in " e.What ", which was called at line " e.Line BadlyCodedFunc() { Throw Exception("Fail", -1) }
Related[編集]
Example(s)[編集]
TryのExample(s)を参照。