Error processing error message when task fails
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 598
- Forks
- 168
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 86
Description
Version
Version provided in latest docker image
Describe the bug
When I POST on “pulp/api/v3/content/file/files/” back-end I receive task which then fails. It is ok.
But I can’t get normal error message to display.
When task fails error message in “description” tag is not returned as valid json object.
I got this:
“error”:{
“traceback”:" …
“description”:"{‘non_field_errors’: [ErrorDetail(string=“There is already a file content with relative path ‘pip.plugin.bitwarden/pip.plugin.bitwarden-1.0.0.tar.gz’ and digest ‘2ba0629a027100546a2919f432a484961ba7cf0308fab341d87cb7dffb9f8b29’.”, code=‘invalid’)]}"
},
To Reproduce
Post two identical files with same path to "pulp/api/v3/content/file/files/" back-end
Expected behavior
It is impossible to normally work with data resewed in error description by not creating custom parser which can parse ErrorDetail object. It would be better if it was json object or string which can be parsed using json parser like:
{“message”:“There is already a file content with relative path ‘pip.plugin.bitwarden/pip.plugin.bitwarden-1.0.0.tar.gz’ and digest ‘2ba0629a027100546a2919f432a484961ba7cf0308fab341d87cb7dffb9f8b29’.”, “code”:‘invalid’}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the duplicate POST to pulp/api/v3/content/file/files/ and inspect how the failed task serializes its error description. Trace the response handling for ErrorDetail values; done means the description is returned as valid JSON that a standard JSON parser can consume, with the error message and code preserved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100