Try OpenEdge Now
skip to main content
Error Handling
Traditional Error Handling : Providing custom error handling : Testing for built-in method warnings
 

Testing for built-in method warnings

Since built-in handle methods treat errors as warnings, you cannot use the IF ERROR-STATUS:ERROR test to detect them. However, even if the ERROR attribute is not set, the error messages are saved in the ERROR-STATUS object. Therefore, if your statement contains a method reference, use this test: IF ERROR-STATUS:NUM-MESSAGES > 0. For example:
DEFINE VARIABLE hSocket AS HANDLE.
CREATE SOCKET hSocket.
hSocket:CONNECT ("-H localhost -S 3333") NO-ERROR.

IF ERROR-STATUS:NUM-MESSAGES > 0 THEN
RUN FailedSocketConnect.p.