Power Tools

59.4.10.5 Handle Errors

Power Tools actions allow exceptions to handle and report errors by including a code like the one below in the Power Shell Script:

$ErrorToThrow = New-Object System.FormatException "This is an error"

Throw $ErrorToThrow

Every time the code above is executed, the following actions will be triggered:

1. The script will throw an error

2. The PowerShell Engine will immediately terminate the script execution (no code will be executed)

3. The error will be reported in the job output file (.psof):

<exitCode>-4</exitCode>
<error><![CDATA[Script execution failed: This is an error]]></error>

4. The DataMover will force the Power Tools action exit with the "error" output (the related error code/message will be specified in the T-Workflow Log)

Note: For a practical example, please refer to the following chapter: "Use SQL queries within scripts".