New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Catch error in datastore #8149
base: master
Are you sure you want to change the base?
Catch error in datastore #8149
Conversation
ckanext/datatablesview/blueprint.py
Outdated
} | ||
) | ||
except ObjectNotFound: | ||
return json.dumps({'error': 'Object not found'}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the response datatables expects on errors? Does it render the text in a dialog box or something?
Should probably also set the response status to 404.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should also catch NotAuthorized here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wardi This function is a response for a POST and only returns JSON with no status (even for errors).
https://github.com/ckan/ckan/blob/master/ckanext/datatablesview/blueprint.py#L141
I just add statu codes for all responses
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should also catch NotAuthorized here
Added here avdata99@ff1b9d7
Catch an error in datastore to avoid 500 error in POSTs to
datatables/ajax/<resource_view_id>
The
datastore_search
action raises this error, it's captured later in this function but not hereFeatures:
Please [X] all the boxes above that apply