Updates a general (vague) Exception error code with a more specific error code. Replaces error codes -1029, -1030, or -1043, if possible.
...exception_object.UpdateErrorCode
Prerequisites
None
Parameters
None
Remarks
Because GPL responds as quickly as possible to error conditions and contains many independent threads, when an exception is thrown, a user thread may not immediately know the exact reason for the exception. In this case, GPL reports one of three generic error codes:
- -1029: Asynchronous error
- -1030: Fatal asynchronous error
- -1043: Asynchronous soft error
Several milliseconds later, the specific error code is normally available, but the system does not wait for this information before initiating a reaction, such as decelerating the robot. The UpdateErrorCode method checks an Exception object’s error code to see if it matches one of the generic error code values listed above. If so, by analyzing error message timestamps, it replaces the generic error code with any more specific error code that has become available. This is a convenience method that eliminates the need to develop software to utilize the Controller.ErrorLog property to scan posted errors for more specific error information.
Examples
Dim exc As Exception
Dim my_loc As Location
Dim my_prof As Profile
Try
Move.Loc(my_loc, my_prof)
Catch exc ' Perform time-critical exception handling here
Console.WriteLine(exc.ErrorCode) ' Show initial error
Thread.Sleep(10) ' Wait for errors to propagate
exc.UpdateErrorCode
Console.WriteLine(exc.ErrorCode) ' Show final error
End Try
See Also