A
Arne Vajhøj
On 7/6/2013 7:14 AM, Robert Klemme wrote:
[...]
Well, you can forget the logging on *any* level of the application.
There is no really a difference between asking the author of this
method
to do proper error handling or asking the author of some other code to
do it.
The caller has more context. When Integer.parseInt() is
unable to make sense of the input string, it has no way of knowing
whether the failure is fatal, unusual, or expected. Do you think
it should log all such failures in addition to throwing up?
No. That is exactly my point.
Okay, you've confused me. I maintain that the caller has more
context than the callee, and is therefore (often) in a better position
to make wider-scope decisions in handling errors. That, it seems to
me, is a distinct and notable difference in how the errors are handled.
Yet you say "there is really no difference" in handling an error Here
or There (or maybe even Elsewhere). I don't get it.
Before you continue the discussion then maybe you should clarify the
topic of discussion: "should called often delegate exception handling to
caller" vs "should called often delegate exception logging to caller".
Arne