When an exception gets raised ‘all the way out’, you get a nice little
call-stack with line-numbers and function names, which really helps
seeing what went wrong, and how. However, I want my application (which
has an infinite mainloop) to keep running, but have that call stack
logged. So I have:
begin
run_worker_process queue_entry[:user][:username],
queue_entry[:directory]
rescue
log_error $!
end
This doesn’t work particularily well for me, because it only mails out
the actual error, not how it happened. Any ideas on how to improve this?
In message “Re: Sorta odd error handling”
on Thu, 22 Jun 2006 18:53:54 +0900, Ohad L. [email protected]
writes:
|logged. So I have:
|
| begin
| run_worker_process queue_entry[:user][:username],
| queue_entry[:directory]
| rescue
| log_error $!
| end
|
|This doesn’t work particularily well for me, because it only mails out
|the actual error, not how it happened. Any ideas on how to improve this?
Can you show us the actual error? The plain rescue clause captures
exceptions that is subclass of StandardError. The error in question
may not be a subclass.
Much thanks! I ended up using a variation on the last guest’s
suggestion.
Question: Class Exception has to_s and to_str. Why not include a builtin
function which would return the full textual description that an
interpreter bail-out would print?