petervizi/python-eeml

raise library specific exceptions

Closed this issue · 2 comments

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

Hi ponty,

Can you provide a patch for this?

Peter

Thanks, it's merged.