Skip to content

Commit

Permalink
error msg change
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbuniat committed Dec 1, 2020
1 parent 91c549a commit a6a604b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions examples/upload_tfds.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import hub
from hub.utils import Timer
from hub import dev_mode

dev_mode()

if __name__ == "__main__":
path = "./data/test/tfds_new/coco"
# path = "s3://snark-test/coco_dataset"
path = "./data/test/coco"
with Timer("Eurosat TFDS"):
out_ds = hub.Dataset.from_tfds("coco", num=10000)
out_ds = hub.Dataset.from_tfds("coco", num=1000)

res_ds = out_ds.store(path)
ds = hub.load(path)
8 changes: 6 additions & 2 deletions hub/client/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def request(

try:
logger.debug(f"Sending: Headers {headers}, Json: {json}")
print(method, request_url, params, data, json, headers, files, timeout)
response = requests.request(
method,
request_url,
Expand Down Expand Up @@ -95,7 +96,7 @@ def check_response_status(self, response):
code = response.status_code
if code < 200 or code >= 300:
try:
message = response.json()["error"]
message = response.json()["description"]
except Exception:
message = " "

Expand All @@ -107,7 +108,10 @@ def check_response_status(self, response):
elif response.status_code == 403:
raise AuthorizationException()
elif response.status_code == 404:
raise NotFoundException()
if message != " ":
raise NotFoundException(message)
else:
raise NotFoundException
elif response.status_code == 429:
raise OverLimitException(message)
elif response.status_code == 502:
Expand Down

0 comments on commit a6a604b

Please sign in to comment.