7stud2
(7stud --)
14 May 2013 23:12
1
What I want to achieve is, is that I can hook into the Exception class
of Ruby so that I can trigger special logging events, when an exception
occurs.
I could easily define custom error classes, but I would like to take a
more general approach.
Does someone have advice on how to do this?
Thanks!
···
--
Posted via http://www.ruby-forum.com/ .
or you can run with `ruby -d`...
···
On May 14, 2013, at 16:12 , Sebastian Wy <lists@ruby-forum.com> wrote:
What I want to achieve is, is that I can hook into the Exception class
of Ruby so that I can trigger special logging events, when an exception
occurs.
7stud2
(7stud --)
15 May 2013 00:00
3
So, this seems to work:
class Exception
def initialize(*args)
puts "initialize"
end
end
The text gets printed out on every exception. I don't how ugly this
solution is and especially how stable, but the functionality seems to be
given.
···
--
Posted via http://www.ruby-forum.com/ .
7stud2
(7stud --)
14 May 2013 23:51
4
Ryan Davis wrote in post #1109018:
···
On May 14, 2013, at 16:12 , Sebastian Wy <lists@ruby-forum.com> wrote:
or you can run with `ruby -d`...
Hi!
This would theoretically be an option, but I would want to pack the
functionality into a Gem, so other users can hook it into their
applications, and thus this would not be an option.
--
Posted via http://www.ruby-forum.com/\ .