This content has been marked as final. Show 2 replies
940103 wrote:Why? What are you going to do with which exception? There need to be valid reasons for code to trap an exception. Exception handlers are exceptions in themselves. Most code units do not need it - as most code units cannot fix the exception and has no reason to react to an exception.
1) I need exception handling / error logging
2) I'd like to return 'more' details to the caller, something likeWrong. This is NOT how error handling works in ANY language.
TYPE io_reply_type IS RECORD
(rcode INTEGER := -1, -- return code
rmsg VARCHAR(2000) := '', -- error message etc
You either catch the exception and fix it (no error occurred from caller's perspective). Or you propagate the exception up the call stack for the caller to deal with.
Returning an exception as an output variable/record of some type? Wrong in Java. Wrong in .Net. Wrong in C++. Wrong in PL/SQL. This violates the basic principle of coding by contract - by not using the default and robust exception management runtime system that exists, but hijacking that, implementing your own, and creating a gross inconsistent behaviour that the caller does not expect, using data structures that the caller does not know about.