vtemian / buffpy

Simple to use python library for Buffer App
MIT License
23 stars 29 forks source link

Handle errors #9

Closed caffodian closed 5 years ago

caffodian commented 10 years ago

I stumbled across this while playing with a test script - errors are not exposed to the caller currently.

I posted the same update text twice and got a crash at the following:

File "/Users/alext/.virtualenvs/zumbido/lib/python2.7/site-packages/buffpy/managers/updates.py", line 132, in new new_update = Update(api=self.api, raw_response=response['updates'][0]) KeyError: 'updates'

Poking around, the actual content returned was {u'message': u"Whoops, it looks like you've posted that one recently. Unfortunately, we're not able to post the same thing again so soon!", u'code': 1025, u'success': False}

I'll look into exposing the Buffer error messages (detailed here: https://bufferapp.com/developers/api/errors) and submit a PR in a few days or so. Unless someone is already looking at this, which is why we have this issue tracker :)