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

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -