try

命令 Instruction Type
Format
try
{ (
エラーの発生する可能性のある処理 Processing potential of the error
} )
catch(引数) catch (argument)
{ (
特定のエラー原因の場合の処理 For treatment of specific causes of error
} )
finally
{ (
エラー全体の処理 Error of the entire process
} )
Commentary
tryでエラーが発生する可能性のある命令、処理等を囲みます。 instruction that may try errors, and surround processing. エラーが発生した場合はcatch、finallyでエラー発生時の処理を行います。 If an error occurs catch, finally in the process when an error occurs. tryは入れ子(ネスト)にすることもできます。 try is nested (nested) can be.
サンプルコード Sample code
try { try (
a = 1 / 0; a = 1 / 0;
} )
catch(e) catch (e)
{ (
alert("エラー内容("+e+")"); alert ( "content error (" + e +")");
} )
finally finally
{ (
outputs[0] = "エラーが発生しました"; outputs [0] = "Error";
} )