Open behrica opened 10 years ago
I went a bit more in detail.
This does not affect "all methods". It affects all methods which use the "get-for" methods. And those methods are the ones returning full list of ressources, so:
domains droplets all-images sizes ssh-keys
(not "regions", it does not use get-for)
The get-for method only returns an error, in case of low-level http errors (= Java exceptions during the call) In case of wrong credentials there is no Exception, just an http code of != 200.
I am not sure, how the methods returning lists should behave in case of http != 200 errors.
In case of http Exceptions they return a map, with a key "error"
{:error #<UnknownHostException java.net.UnknownHostException: aaaapi.digitalocean.com>}
the other methods return a map like this:
{:status "ERROR", :error_message "Access Denied", :message "Access Denied"}
which is the direct response from digital ocean API.
Calling the methods (all probably) with wrong client id or api-key does not give an error, but returns nil. Example:
I debugged this and it looks like the eror detection does not work. In the case of wrong credentials the "error" variable is nil, as there is no "error" key in the "resp" response:
This error could be detected by checking for http status 401.