Make Watch.Log cause a error and stop

Hi

Is there a way to make a script actually cause a error so onerror kicks in? I’ve tried using Watch.Log(“ERROR”,1) which shows the error in red but it doesn’t seem to stop the processing

James

Hello James,

You can throw an error by applying something like the following JavaScript code to your Run Script Workflow plugin:

throw new Error("This is an user-defined exception...");

Result:

04:41:45.473 [0002] Run embedded script...
04:41:45.473 [0002] W3602 : Error 0 on line 1, column 1: Microsoft JScript runtime error: This is an user-defined exception...
04:41:45.474 [0002] W3603 : Error running script.
04:41:45.474 [0002] Run Script: W1603 : Plugin failed - 04:41:45 (elapsed time: 00:00:00.005)

Source: ‘throw - JavaScript | MDN (link)’

1 Like

Thanks for that Marten

1 Like