From: Daniel Berger Date: 2005-05-14T06:05:22+09:00 Subject: Customing the Exception class Hi all, I have a program where I want to send all errors to a file. So, I did this: class Exception alias :old_init :initialize def initialize(arg) old_init(arg) File.open("log.txt","a+"){ |fh| fh.puts("Error: #{arg}") } end end This works for most errors, but it doesn't seem to work when the error is a SystemCallError. For example, this writes to the log as expected: print "Some crazy division: " p 1/0 But this does not: File.open("non-existant file") The latter raises an Errno::ENOENT. Why, if SystemCallError is a subclass of Exception, does my approach not work? How do I make this work as expected? Regards, Dan