Improve error reporting in astakos
authorGiorgos Verigakis <verigak@gmail.com>
Tue, 13 Mar 2012 14:25:30 +0000 (16:25 +0200)
committerGiorgos Verigakis <verigak@gmail.com>
Tue, 13 Mar 2012 14:25:30 +0000 (16:25 +0200)
kamaki/clients/astakos.py

index db082c5..89798bb 100644 (file)
@@ -37,6 +37,14 @@ from . import Client, ClientError
 class AstakosClient(Client):
     """GRNet Astakos API client"""
     
+    def raise_for_status(self, r):
+        msg = r.text.strip()
+        if msg:
+            raise ClientError(msg, r.status_code)
+        else:
+            # Fallback to the default
+            super(AstakosClient, self).raise_for_status(r)
+    
     def authenticate(self):
         r = self.get('/im/authenticate')
         return r.json