@@ -124,11 +124,14 @@ def detect(self, image_bytes: bytes):
124
124
response = post_image (url , image_bytes , self ._api_key , self ._timeout )
125
125
126
126
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
+ )
128
130
return
129
131
130
132
self ._response = response .json ()
131
133
if not self ._response ["success" ]:
134
+ error = self ._response ["error" ]
132
135
raise DeepstackException (f"Error from Deepstack: { error } " )
133
136
134
137
@property
@@ -222,9 +225,12 @@ def recognise(self, image_bytes: bytes):
222
225
response = post_image (url , image_bytes , self ._api_key , self ._timeout )
223
226
224
227
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
+ )
226
231
return
227
232
228
233
self ._response = response .json ()
229
234
if not self ._response ["success" ]:
235
+ error = self ._response ["error" ]
230
236
raise DeepstackException (f"Error from Deepstack: { error } " )
0 commit comments