|
Hello Barbara, > Besides that, in general, I'd rather monitor for exceptions than check > if an error occurred. If you use exception-based code, you don't have > to worry about forgetting an opportunity to check for errors. If you > forget to check the feedback, you can have silent errors; forgetting to > code an exception handler gives you a nice noisy error. > > So most of the time I code *OMIT for the feedback and bytesProvided = 0 > for the errcode. I absolutely agree with you. I think one of the things that makes the iSeries more stable than other platforms is the exception handling. The fact that errors default to a program "crash" instead of the program having to check the return code and signal it's own error if something failed. The problem that this creates on other platforms (most notably Windows) is that if there's a particular error that doesn't occur to a programmer, the error can go unnoticed and the code and continue with strange results. This leads to errors in production that are very difficult to trace back to the source. Java also uses this "you must handle it or pass it on" type of exception method, which is great. One thing, though... if your program EXPECTS certain errors to occur it should remove the error message from the job log so that it does not confuse someone who is trying to troubleshoot something unrelated. For example, if your program asks a user for a date, calls a CEE* API to parse that date, and expects the possibility of an "invalid date" error, it should handle the error AND remove the error from the job log. Too many times programmers will leave this stuff in the job log, and that only creates confusion. Just my opinion of course.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.