Wiredcraft / dopy

Digital Ocean Python
MIT License
95 stars 62 forks source link

Enhance error handling #1

Closed neomantra closed 11 years ago

neomantra commented 11 years ago

Although the DigitalOcean API spec says that the error message will be in the field 'message', I was getting some in the field 'error_message'. This was happening with a HTTP error code of 404 so the current code was not catching it.

The raise DoError(json['message') actually raised an exception, namely KeyError: message. In the Ansible module, this was giving the very unhelpful error { "failed": true, "msg": "message" }.

This commit adds some error handling to the error handling.

polyrabbit commented 11 years ago

Merged, thank you.