Insufficient error reporting, more humane validation/error messages needed
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 109
- Forks
- 107
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 4
Description
I have a Dexterity content type with a table z3cform.datagridfield with a row specification that contains
class ITableRowSchema(form.Schema):
date_from = schema.Date(
title=_(u'Start date'),
required=True,
defaultFactory=default_date
)
...
If you pass an ISO8601 string for date_from then the error is:
ˋˋˋ
Module plone.restapi.deserializer.dxcontent, line 114, in call
BadRequest: [{'field': 'table', 'message': u'Wrong contained type', 'error': WrongContainedType([WrongContainedType([AttributeNotFoundError(), AttributeNotFoundError(), AttributeNotFoundError()], '')], 'table')}]
ˋˋˋ
The error message does not contain the name of the offending field date_from but three times it mentions AttributeNotFoundError().
If you omit the require field date_from then the error is also bit useless:
BadRequest: [{'field': 'table', 'message': u'Wrong contained type', 'error': WrongContainedType([WrongContainedType([AttributeNotFoundError(),
AttributeNotFoundError(), AttributeNotFoundError(), AttributeNotFoundError()], '')], 'table')}]
As a user of the REST api I am interested in more precise error message instead of propagating back "internal" tracebacks/errors.
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 at plone.restapi.deserializer.dxcontent around line 114 and reproduce the table validation failures with an ISO8601 date_from value and with the required field omitted. Trace how the nested WrongContainedType and AttributeNotFoundError values become the REST response. Done means the response identifies the offending date_from field and reports a precise, user-facing validation error instead of the repeated internal errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100