Error Handling
Every reply from the CLIENT process includes the LightWave reply header followed by user data if the request was successful or error information if an error occurred. The reply header has the following format:
DEF LIGHTWAVE-RP-HEADER.
02 RP-CODE TYPE BINARY 16.
02 HTTP-STATUS TYPE BINARY 16.
02 INFO-CODE TYPE BINARY 16.
02 INFO-DETAIL TYPE BINARY 16.
02 RESERVED PIC X(24).
END.
The rp-code field will contain one of the following values:
DEF LIGHTWAVE-RP-CODE-ENUM TYPE ENUM BEGIN.
89 LW-RP-SUCCESS VALUE 0.
89 LW-RP-INFO VALUE 1.
89 LW-RP-ERROR VALUE 2.
END.
These values should be interpreted as follows:
- If RP-CODE contains LW-RP-SUCCESS, the request was successful and user data follows the LightWave header.
- If RP-CODE contains LW-RP-INFO, the request was successful but string field or array truncation occurred while the response was being processed. In this case the contents of the INFO-CODE and INFO-DETAIL fields will describe the condition that occurred.
- If RP-CODE contains LW-RP-ERROR then an error occurred while processing the request.
Handling Field and Array Truncation Warnings
When RP-CODE contains LW-RP-INFO, the iNFO-CODE field will contain one of the following values:
DEF LIGHTWAVE-INFO-CODE-ENUM TYPE ENUM BEGIN.
89 LW-INFO-FIELD-TRUNCATED VALUE 100.
89 LW-INFO-ARRAY-TRUNCATED VALUE 101.
END.
If INFO-CODE contains LW-INFO-TRUNCATED then a string value in the service response message was too long to copy to the associated string field in the reply IPM. In this case the iNFO-DETAIL field contains the IPM offset of the string field that caused the warning.
If INFO-CODE contains LW-INFO-OVERFLOW, then an array in the response message contained more elements than were defined in the associated array in the reply IPM. In this case the iNFO-DETAIL field contains the IPM offset of the array that caused the warning.
Although it is possible for multiple string or array truncations to occur in a single response, CLIENT only reports the first occurrence of the truncation.
Handling Errors
When RP-CODE contains LW-RP-ERROR, the reply IPM is formatted as a LIGHTWAVE-ERROR-RP structure which contains detailed information about the error.
DEF LIGHTWAVE-ERROR-RP.
02 LIGHTWAVE-RP-HEADER TYPE LIGHTWAVE-RP-HEADER.
02 ERROR-SOURCE TYPE BINARY 32.
02 ERROR-CODE TYPE BINARY 32.
02 ERROR-SUBCODE TYPE BINARY 32.
02 ERROR-MESSAGE PIC X(4096).
END.
The ERROR-SOURCE field contains one of the error source values and identifies the subsystem that reported the error.
DEF LIGHTWAVE-ERROR-SRC-ENUM TYPE ENUM BEGIN.
89 LW-ERROR-SRC-LIGHTWAVE VALUE 1.
89 LW-ERROR-SRC-HTTP VALUE 2.
89 LW-ERROR-SRC-TCPIP VALUE 3.
89 LW-ERROR-SRC-SSL VALUE 4.
END.
If ERROR-SOURCE contains LW-ERROR-SRC-LIGHTWAVE then ERROR-CODE will contain one of the following LIGHTWAVE-ERROR-ENUM values:
DEF LIGHTWAVE-ERROR-ENUM TYPE ENUM BEGIN.
89 LW-ERROR-INVALID-LICENSE VALUE 1.
89 LW-ERROR-INVALID-HEADER VALUE 2.
89 LW-ERROR-INVALID-RQ-CODE VALUE 3.
89 LW-ERROR-INVALID-TYPE VALUE 4.
89 LW-ERROR-SERIALIZATION-ERROR VALUE 5.
89 LW-ERROR-DESERIALIZATION-ERROR VALUE 6.
89 LW-ERROR-REQUEST-TIMEOUT VALUE 7.
89 LW-ERROR-RESPONSE-NOT-DEFINED VALUE 12.
89 LW-ERROR-INVALID-URI-SCHEME VALUE 100.
89 LW-ERROR-INVALID-API-DEF VALUE 101.
89 LW-ERROR-INVALID-BASE-URI VALUE 102.
89 LW-ERROR-INVALID-HDR-VERSION VALUE 103.
89 LW-ERROR-SIGNATURE-ERROR VALUE 104.
89 LW-ERROR-INTERNAL-ERROR VALUE 500.
END.
The ERROR-SUBCODE and ERROR-MESSAGE fields may contain additional information.
If ERROR-SOURCE contains any other error source value, the remaining error fields provide the error codes and message reported by that subsystem.
The error source value LW-ERROR-SRC-SSL may refer to an error encountered on an SSL or TLS connection.
The error source value LW-ERROR-INVALID-TYPE is not used in will not be returned. The value has been left in the definition in order avoid affecting existing applications that may reference it.