BlueBrain / BlueBrain/nexus-python-sdk
improve error message for create_link method.
- Lingua principale
- Python
- Stelle
- 6
- Fork
- 10
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
I put a wrong media_type "directory" while calling create_link.
I would say it is not obvious to understand the issue.Here is the error I got:
[13:00:35]
OrderedDict([('@context', ['https://bluebrain.github.io/nexus/contexts/iam.json', 'https://bluebrain.github.io/nexus/contexts/resource.json']), ('@id', 'http://dev.nexus.ocp.bbp.epfl.ch/v1/permissions'),
('@type', 'Permissions'), ('permissions', ['acls/read', 'acls/write', 'events/read', 'files/write', 'organizations/create', 'organizations/read', 'organizations/write', 'permissions/read', 'permissions/write', 'projects/create', 'projects/read', 'projects/write', 'realms/read', 'realms/write', 'resolvers/write', 'resources/read', 'resources/write', 'schemas/write', 'storages/write', 'views/query', 'views/write']), ('_rev', 0), ('_createdAt', '1970-01-01T00:00:00Z'), ('_createdBy', 'http://dev.nexus.ocp.bbp.epfl.ch/v1/anonymous'), ('_updatedAt', '1970-01-01T00:00:00Z'), ('_updatedBy', 'http://dev.nexus.ocp.bbp.epfl.ch/v1/anonymous')])
Traceback (most recent call last):
File "test.py", line 32, in
result = nexus.files.create_link(org_label=ORG, project_label=PROJ, filename= 'circuit_renamed', filepath = 'courcol/circuit', media_type='directory', file_id='foobar')
File "/Users/courcol/DEV/nexus-sdk/nexus-python-sdk/nexussdk/files.py", line 139, in create_link
return http_put(request_path, body=payload, storage=storage_id)
File "/Users/courcol/DEV/nexus-sdk/nexus-python-sdk/nexussdk/utils/http.py", line 168, in http_put
response.raise_for_status()
File "/Users/courcol/DEV/nexus-sdk/venv/lib/python3.7/site-packages/requests/models.py", line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Reproduce the invalid media_type case shown in test.py and trace create_link in nexussdk/files.py around line 139 into http_put in nexussdk/utils/http.py around line 168. Determine where the current HTTP error loses useful context, then verify that the resulting message clearly identifies the invalid input and run the relevant existing tests.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- api
- Tipo di issue
- Bug
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100