Skip to content
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

[validate] Report details of data validation errors #231

Closed
1 task done
rufuspollock opened this issue Dec 29, 2017 · 1 comment
Closed
1 task done

[validate] Report details of data validation errors #231

rufuspollock opened this issue Dec 29, 2017 · 1 comment
Assignees

Comments

@rufuspollock
Copy link
Member

rufuspollock commented Dec 29, 2017

Running data validate gives error messages like this but without listing the actual error:

> Error! There are 1 type and format mismatch errors (see 'error.errors')

This is not very helpful as i can't fix the error.

Tasks

  • Change data validate to report errors in detail

Analysis

OK: finally tracked it down - https://github.com/frictionlessdata/tableschema-js/blob/master/src/table.js#L100

try {
  row = this.schema.castRow(row)
} catch (error) {
  error.rowNumber = rowNumber
  error.errors.forEach(error => {error.rowNumber = rowNumber})
  throw error
}

Note: there also header errors that have a slightly different structure afaict ... https://github.com/frictionlessdata/tableschema-js/blob/master/src/table.js#L102

The errors here are TableSchemaError.

@rufuspollock rufuspollock added this to the Sprint - 15 Jan 2018 milestone Dec 29, 2017
@rufuspollock rufuspollock self-assigned this Dec 29, 2017
rufuspollock added a commit that referenced this issue Dec 29, 2017
Running data validate gives error messages like this but without listing the actual error:

    > Error! There are 1 type and format mismatch errors (see 'error.errors')

This is not very helpful as i can't fix the error with this info.

I fixed this by analysing structure of errors which come from tableschema.js:

https://github.com/frictionlessdata/tableschema-js/blob/master/src/table.js#L100

Note: only addressing the data errors. There also header errors that have a slightly different structure afaict ... https://github.com/frictionlessdata/tableschema-js/blob/master/src/table.js#L102
@rufuspollock
Copy link
Member Author

rufuspollock commented Dec 29, 2017

FIXED. Note:

  • I think some work may be needed on tableschema-js to improve this. e.g. we only find the first error and reports don't make the goodtables report structure
  • Also not sure i handle header errors
  • No testing of this (it is output stuff ...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant