You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When creating a project record, if a validation error occurs, a non-descriptive error message ({ "error": "service failure - try again later"}) is returned with a status of 500.
Viewing the pod logs, I get more info:
[2019-09-26 19:21:47,461][sheepdog.api][ ERROR] Value '' not in allowed value list for ['Open', 'Restricted'] for property availability_type.
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/sheepdog/sheepdog/utils/__init__.py", line 123, in check
return func(program, *args, **kwargs)
File "/sheepdog/sheepdog/blueprint/routes/views/program/__init__.py", line 186, in create_project
node.props.update(base_doc)
File "/usr/lib/python2.7/site-packages/psqlgraph/attributes.py", line 57, in update
setattr(self.source, key, val)
File "/usr/lib/python2.7/site-packages/sqlalchemy/ext/hybrid.py", line 900, in __set__
self.fset(instance, value)
File "/usr/lib/python2.7/site-packages/psqlgraph/base.py", line 281, in hybrid_prop
validate(fset, value, fset.__pg_types__, fset.__pg_enum__)
File "/usr/lib/python2.7/site-packages/psqlgraph/util.py", line 22, in validate
).format(value, enum, f.__name__))
Since this is a user input error, I'd expect a 400 Bad Request response code with errors embedded in the response:
{"errors": {"availability_type": "Value '' not in allowed value list for ['Open', 'Restricted']"}}
This example response is just a suggestion, but it would be nice to inform the React application of the specific field where an error occurred, so server-side error messages can be rendered on the client. This is beneficial because you don't need to implement client-side validation in addition to server-side.
The text was updated successfully, but these errors were encountered:
When creating a project record, if a validation error occurs, a non-descriptive error message (
{ "error": "service failure - try again later"}
) is returned with a status of500
.Viewing the pod logs, I get more info:
Since this is a user input error, I'd expect a
400 Bad Request
response code with errors embedded in the response:This example response is just a suggestion, but it would be nice to inform the React application of the specific field where an error occurred, so server-side error messages can be rendered on the client. This is beneficial because you don't need to implement client-side validation in addition to server-side.
The text was updated successfully, but these errors were encountered: