[KM] Script Error Handler [Sub-Macro]

MACRO: [KM] Script Error Handler [Sub-Macro]


VER: 1.0     2016-08-10 ~~~~~

DOWNLOAD:

[KM] Script Error Handler [Sub-Macro].kmmacros (8.0 KB)


Use Case:

  • Provide a standard means of handling script errors in a KM "Execute Script" Action.

For a discussion about this topic, see:
What is Best Practice for Handling Script Errors in Execute Script Action?

Please feel free to post any issues, bugs, comments, alternate solutions, and/or suggestions for improvements.


Author: @JMichaelTX

PURPOSE: Test Response/Resuts from Execute Script Action
IF Error was returned, then Display Error Msg & CANCEL Macro

HOW TO USE: (This is a SUB-MACRO)

(1) Make sure your Script uses a try/catch block around the entire script
• Script MUST return "[OK]" & the actual results if no error
• Script returns error msg if error occurrs

(2) Insert "Execute Macro" Action into your Macro immeditely AFTER the "Execute Script" Action

(3) Set the Parameter to the same Variable Name used in the "Execute Script" results variable.

EXAMPLE USAGE:

WHAT IT DOES:

(1) IF Script Error: Display Error Message and CANCEL Macro
(2) IF NO Error: Remove "[OK]" from results variable, and CONTINUE