Fix error handling of API requests.
RELEASE 0.1