Error handling in GWS calls (STATUS)

When errors are encountered, the methods of GWS classes can throw exceptions and set the STATUS variable with the appropriate error number.

By default, the program will stop if an exception is thrown. You can trap the GWS errors with a WHENEVER ERROR handler or with a TRY/CATCH block. In the example, the readTextRequest() API is surrounded by a TRY/CATCH block:
DEFINE req com.HTTPServiceRequest,
       data STRING
LET req = com.WebServiceEngine.getHTTPServiceRequest(5)
   CALL req.readTextRequest() RETURNING data
   CALL show_err(SFMT("Unexpected HTTP request read exception: %1", STATUS))

For some errors, a human-readable description of the error code is available in the SQLCA.SQLERRM register.