× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Scott,

I probably didn't explain myself correctly. I was talking about trapping named errors/exceptions using on-error directly. An example would make it clearer. :-)

Rather than this..:

d RECORD_LOCK     c                   const(01218)
d RESULT_TOO_BIG  c                   const(00103)
d ERROR_1         c                   const(some value)
d ERROR_2         c                   const(some other value)

monitor;

doSomething();

on-error RECORD_LOCK;      // Record Lock
 dsply 'Record Locked';

on-error *FILE;            // Any other file error
 statusCode = %Status;
 dsply StatusCode;
 dsply 'Some File Error';

on-error RESULT_TOO_LARGE; // Field not large enough to hold result
 dsply 'Field is not large enough';

on-error *PROGRAM;         // Any other program error
 statusCode = %Status;
 dsply StatusCode;
 dsply 'Some Program Error';

on-error;                 // Any error not already trapped
select;
when messageID = ERROR_1
 dsply 'Error 1 occurred';
when messageID = ERROR_2;
 dsply 'Error 2 occurred';
endMon;

I'd like to do this..:


d RECORD_LOCK     c                   const(01218)
d RESULT_TOO_BIG  c                   const(00103)
d ERROR_1         c                   const(some value)
d ERROR_2         c                   const(some other value)

monitor;

doSomething();

on-error RECORD_LOCK;      // Record Lock
 dsply 'Record Locked';

on-error *FILE;            // Any other file error
 statusCode = %Status;
 dsply StatusCode;
 dsply 'Some File Error';

on-error RESULT_TOO_LARGE; // Field not large enough to hold result
 dsply 'Field is not large enough';

on-error *PROGRAM;         // Any other program error
 statusCode = %Status;
 dsply StatusCode;
 dsply 'Some Program Error';

on-error ERROR_1;          // Custom error 1
 dsply 'Error 1 occurred';

on-error ERROR_2;          // Custom error 2
 dsply 'Error 2 occurred';
endMon;

It is the explicit trapping of a NAMED error that I'd like to do, but think I probably can't do. Like you said though, I could just call a named procedure in the on-error *all block and propigate that way. I'll take a look in the archives at the thread you mentioned.

Thanks for your help

Larry Ducie



As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.