Skip to content

Commit

Permalink
ENH: print human accessible error, no big traces if we fail to assure…
Browse files Browse the repository at this point in the history
… having a collection
  • Loading branch information
yarikoptic committed Jan 30, 2020
1 parent 88176ae commit 6b421a0
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion dandi/cli/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,19 @@ def upload(

client = girder.authenticate(girder_instance)

collection_rec = girder.ensure_collection(client, girder_collection)
try:
collection_rec = girder.ensure_collection(client, girder_collection)
except girder.gcl.HttpError as exc:
if develop_debug:
raise
# provide a bit less intimidating error reporting
lgr.error(
"Failed to assure presence of the %s collection: %s",
girder_collection,
(girder.get_HttpError_response(exc) or {}).get("message", str(exc)),
)
sys.exit(1)

lgr.debug("Working with collection %s", collection_rec)

local_top_path = Path(local_top_path).resolve()
Expand Down

0 comments on commit 6b421a0

Please sign in to comment.