Method: RaiseError for ContextInitialize <Analysis Automation>
- Updated2024-09-12
- 1 minute(s) read
Methods > Method: RaiseError for ContextInitialize <Analysis Automation>
Method: RaiseError for ContextInitialize <Analysis Automation>
Terminates the On_Initialize event with an error message without executing further commands. In a parallel analysis, Analysis Automation executes the On_Finalize event afterwards anyway.
Object.RaiseError(errNumber, message)
| Object | ContextInitialize <Analysis Automation> Object with this method |
| errNumber | LongInteger Specifies the error number. |
| message | String Contains the error text. |
The following examples aborts the script with an error message when the parameter for the result path is missing:
| VBScript | Python |
Sub On_Initialize(oContext) Dim ResultsPath, oMyArguments Set oMyArguments = oContext.Procedure.Arguments If oMyArguments.Exists("ResultsPath") Then ResultsPath = oMyArguments.Item("ResultsPath").Value Call oContext.LogResult("Results path: " & ResultsPath) Else Call oContext.RaiseError(1,"Results path missing") End If End Sub