petervizi / python-eeml

A python package for generating eeml documents.
http://petervizi.github.com/python-eeml
GNU General Public License v3.0
43 stars 11 forks source link

raise library specific exceptions #9

Closed ponty closed 12 years ago

ponty commented 12 years ago

It would be better if I could catch a library specific exception in case of communication error. This is my code now, it caches everything:

    pa = eeml.Pachube(feed, key)
    pa.update([eeml.Data(stream, round(x.celsius, 1), unit=Celsius()), ])
    try:
        pa.put()
    except Exception, e:
    # better: except PachubeError, e:
        print e

library specific exception examples: http://docs.python.org/tutorial/errors.html#user-defined-exceptions

petervizi commented 12 years ago

Hi ponty,

Can you provide a patch for this?

Peter

petervizi commented 12 years ago

Thanks, it's merged.