Production object methods  Error codes

Chapter 3: Building Production Objects

Alternate error return values

Use the setErrNum(), setErrTxt(), and getAlterrtext() production object methods to augment the return value and error text generated by a production object’s custom filter, error, generic, and qualification functions. These methods allow you to add a unique error number and error message to each function so that you can immediately determine within which function the processing error occurred.

Use the setErrNum() and setErrTxt() methods to add an alternate error number and error message to the error text generated by the production object.

NoteYou must use both of these methods for the getAlterrtext() method to function.

These methods do not replace the error number and error text generated by the production object. They append extra information to the error message generated by the production object, using this format:

tran error text, which can contain line feeds 
the alternate error text rv = the alternate error number

When a processing failure occurs, the alternate error values that display are those of the last function that called one of these methods. For example, when a custom filter function that calls these methods fails, the error function executed next also uses these methods. The error message generated by the production object contains the alternate error text set by the error function, not the custom filter.

When you use setErrNum(), and setErrTxt() methods in a function, they set the alternate error text regardless of whether the function encounters a processing error. Therefore, if the function that fails does not call the setErrNum() and setErrTxt() methods, but a previously executed function did, the alternate error text generated by the production object does not reflect the function where the processing failure actually occurred.

Use the getAlterrtext() method to read the alternate error number and alternate error message into datalink objects or data variables. This is useful to perform specific actions in the production object’s error function depending on which function encountered the processing error.





Copyright © 2005. Sybase Inc. All rights reserved. Error codes

View this book as PDF