@@ -124,11 +124,14 @@ def detect(self, image_bytes: bytes):
124124 response = post_image (url , image_bytes , self ._api_key , self ._timeout )
125125
126126 if not response .status_code == HTTP_OK :
127- raise DeepstackException (f"Error from request: { response .status_code } " )
127+ raise DeepstackException (
128+ f"Error from request, status code: { response .status_code } "
129+ )
128130 return
129131
130132 self ._response = response .json ()
131133 if not self ._response ["success" ]:
134+ error = self ._response ["error" ]
132135 raise DeepstackException (f"Error from Deepstack: { error } " )
133136
134137 @property
@@ -222,9 +225,12 @@ def recognise(self, image_bytes: bytes):
222225 response = post_image (url , image_bytes , self ._api_key , self ._timeout )
223226
224227 if not response .status_code == HTTP_OK :
225- raise DeepstackException (f"Error from request: { response .status_code } " )
228+ raise DeepstackException (
229+ f"Error from request, status code: { response .status_code } "
230+ )
226231 return
227232
228233 self ._response = response .json ()
229234 if not self ._response ["success" ]:
235+ error = self ._response ["error" ]
230236 raise DeepstackException (f"Error from Deepstack: { error } " )
0 commit comments