Progress
External Program
Interfaces
Error Handling
When a Progress SAX application parses an XML document, it might encounter one of three distinct parse-related error situations. They are:
- SAX-PARSE(), SAX-PARSE-FIRST(), or SAX-PARSE-NEXT() detects an error and cannot complete its current parse operation.
This might be caused by one of the following:
- The specified XML source does not exist.
- The handle to the procedure containing the callbacks is invalid.
- SAX-READER was not in the appropriate state. This can happen, for example, if SAX-PARSE-NEXT() was called before SAX-PARSE-FIRST().
If this error situation occurs:
- Parsing stops.
- Progress raises an error.
If NO-ERROR was specified, Progress sets ERROR-STATUS:ERROR to YES, sets ERROR-STATUS:NUM-MESSAGES to the number of errors encountered, and returns a Progress error message in response to a statement with the following syntax:
where err-msg-num indicates a number between 1 and ERROR-STATUS:NUM-MESSAGES inclusive.
If NO-ERROR was not specified, Progress looks in the driver routine for the closest block that has the error property and behaves as if the block has an explicit ON ERROR phrase.
- A callback raises an error by using the RETURN statement’s ERROR option.
If this error situation occurs:
- Parsing stops.
- Progress raises an error.
If NO-ERROR was specified, Progress sets ERROR-STATUS:ERROR to YES and sets ERROR-STATUS:NUM-MESSAGES to zero.
If NO-ERROR was not specified, Progress looks in the driver routine for the closest block that has the error property and behaves as if the block has an explicit ON ERROR phrase.
NOTE: If a callback procedure calls a second procedure, the second procedure calls a third procedure, etc., and the final procedure in the chain executes RETURN ERROR, each preceding procedure in the chain must also execute RETURN ERROR, else the error condition is never communicated to the driver routine. This is standard Progress behavior.- RETURN-VALUE is set to whatever string the RETURN statement included.
- While a callback is executing, Progress raises an error that the callback does not handle—for example, a FIND CUSTOMER that fails to find the specified customer.
If this error situation occurs:
- The error is displayed (which is standard Progress behavior).
- In the callback, Progress finds the closest block that has the error property (which might be the PROCEDURE block) and behaves according to the block’s explicit or implicit ON ERROR phrase. This might cause Progress to break out of the callback.
- The PARSE-STATUS attribute and the ERROR-STATUS handle are unaffected.
- The parse continues.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |