python find exception message (with ast?) -
i want compile list of messages program present user, errors (to able quality-check wording). let's assume have own exception class
class myexception( exception ): pass
and want find programmatically instances
raise myexception( "this baadly worded message typo." )
is there elegant python way retrieve:
- the message
- the line number
- the (member) function name raises exception?
ideally, work cases like
msg = "my long error message\n" msg += "where explain fit directly raise call" raise myexception( msg )
so want localize python application.
in case have loot @ gettext powerful localization framework, 1 used open-source projects, not python ones.
Comments
Post a Comment