BlueBrain / BlueBrain/nexus-python-sdk
improve error message for create_link method.
- Ngôn ngữ chính
- Python
- Star
- 6
- Fork
- 10
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
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)
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Tái hiện trường hợp media_type không hợp lệ được示示 trong test.py và lần theo create_link trong nexussdk/files.py quanh dòng 139 đến http_put trong nexussdk/utils/http.py quanh dòng 168. Xác định nơi lỗi HTTP hiện tại làm mất ngữ cảnh hữu ích, sau đó xác minh rằng thông báo kết quả xác định rõ đầu vào không hợp lệ và chạy các bài kiểm thử hiện có liên quan.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- api
- Loại issue
- Lỗi
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100