R
Runsun Pan
Is it possible to code a class that raise exception
automatically when an error occurs?
We usually use try-except pair at where we expect an
error might occur. What am thinking is a class that
has built in error handling so we can do this:
c=MyClass()
c.onError = some_hook
or
c.onError('IndexError', IndexErrorHook)
or, more specific, a function/method-specific error
handling feature:
c.load.onError( IOErrorHook)
c.load( filename )
Is there such a mechnism around? If not, is it possible
to make such a thing ?
--
~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~
Runsun Pan, PhD
(e-mail address removed)
Nat'l Center for Macromolecular Imaging
http://ncmi.bcm.tmc.edu/ncmi/
~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~
automatically when an error occurs?
We usually use try-except pair at where we expect an
error might occur. What am thinking is a class that
has built in error handling so we can do this:
c=MyClass()
c.onError = some_hook
or
c.onError('IndexError', IndexErrorHook)
or, more specific, a function/method-specific error
handling feature:
c.load.onError( IOErrorHook)
c.load( filename )
Is there such a mechnism around? If not, is it possible
to make such a thing ?
--
~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~
Runsun Pan, PhD
(e-mail address removed)
Nat'l Center for Macromolecular Imaging
http://ncmi.bcm.tmc.edu/ncmi/
~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~