BlueBrain / BlueBrain/nexus-python-sdk
improve error message for create_link method.
- Vorherrschende Sprache
- Python
- Sterne
- 6
- Forks
- 10
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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)
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- api
- Issue-Typ
- Bug
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100