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.