Try-catch
- Last UpdatedJul 05, 2024
- 1 minute read
If an error is expected, one that is not critical to the Application Calculation Engine (ACE) Configuration (aceconfig) record, then try-catch is used to trap it.
This is only to be used for expected errors; ones that should not cause the aceconfig record to be disabled. All other errors are ignored so that the ACE can effectively manage the execution of the ACE points and alarms when things go wrong. To catch a specific error, substitute the type of error to be caught for the word "Exception". For example "catch DNAException" catches all AVEVA Enterprise SCADA exceptions that are thrown.
Try
Dim i As Integer
Dim j As Integer = 0
i = 1 / j
Catch ex As Exception
DNALog.WriteLog(DNALog.LogLevel.Always, "Caught an error")
End Try