From: swille Date: 2005-11-10T07:30:05+09:00 Subject: Re: Logging vs. Exceptions > def x > : > begin > res = y( args ) > rescue > log("error calling method: y") > # the method calling x should handle this > # or maybe we should propagate the exception thrown from y > # (or re throw a new one) for the caller to handle > return nil > end > > return res > end > > def y > : > # do a lots of commands that may throws exceptions > if error > raise Exception.new("something went wrong") > end > : > return res > end IMHO, your y method is almost defeating the purpose of exceptions -- you can't get a backtrace to figure out what exactly went wrong. But of course, without seeing the processing that's going on in y, it's hard to say what the semantics should really be. Maybe you really do need to process each line regardless of whether the previous one succeeded. Also, I don't know what res would return from y, but maybe in this case an integer/errno type of return would be appropriate. At least then you might be able to explain or handle what's happened without interrupting the processing in y.