[ckan-changes] [ckan/ckan] dd4d33: Improve DataStore's error message on invalid data

GitHub noreply at github.com
Tue Dec 16 19:30:13 UTC 2014


  Branch: refs/heads/improve-datapusher-error-messages
  Home:   https://github.com/ckan/ckan
  Commit: dd4d33d874e63711b6b8a33e1b45d3ab4eb53783
      https://github.com/ckan/ckan/commit/dd4d33d874e63711b6b8a33e1b45d3ab4eb53783
  Author: Sean Hammond <git at seanh.cc>
  Date:   2014-12-16 (Tue, 16 Dec 2014)

  Changed paths:
    M ckanext/datastore/db.py
    M ckanext/datastore/logic/action.py
    M ckanext/datastore/tests/test_create.py
    M ckanext/datastore/tests/test_db.py

  Log Message:
  -----------
  Improve DataStore's error message on invalid data

When adding data to the datastore it may come across an invalid data value
(e.g. a non-numeric string, when the column has a numeric type).

Sqlalchemy will raise its DataError. Catch this and raise a custom
InvalidDataError. The datastore_create() action then catches this and raises
toolkit.ValidationError which ends up returning an error dict to the API
caller.

I'm not sure if this commit covers all cases - e.g. create vs updating a
datastore resource.


  Commit: 75957ff72fb60538ff0b4e0dd222135729d58abe
      https://github.com/ckan/ckan/commit/75957ff72fb60538ff0b4e0dd222135729d58abe
  Author: Sean Hammond <git at seanh.cc>
  Date:   2014-12-16 (Tue, 16 Dec 2014)

  Changed paths:
    M ckanext/datastore/db.py
    M ckanext/datastore/tests/test_create.py

  Log Message:
  -----------
  Change a DataStore error message

Make it a little more human-friendly


Compare: https://github.com/ckan/ckan/compare/9ff14ece784a...75957ff72fb6


More information about the ckan-changes mailing list