From 6b421a0374b167d7daf9dc5dec29001a72a79ef5 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 30 Jan 2020 16:09:40 -0500 Subject: [PATCH] ENH: print human accessible error, no big traces if we fail to assure having a collection --- dandi/cli/command.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/dandi/cli/command.py b/dandi/cli/command.py index fb072cda6..830efc34a 100644 --- a/dandi/cli/command.py +++ b/dandi/cli/command.py @@ -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()