frictionlessdata / tableschema-js

A JavaScript library for working with Table Schema.
http://frictionlessdata.io/
MIT License
82 stars 27 forks source link

Improved error messages #94

Closed roll closed 7 years ago

roll commented 7 years ago
roll commented 7 years ago

@Stephen-Gates Could you please take a look? I've improved some error messages (syncing some with Data Quality Spec). But still it's not exactly the same in high-level because various reasons like (some of this problems are solvable):

So here is a question how far we should improve it. Is it a real blocker for data-curator. Problem here that error messages here is a exceptional situation messages. It's not intended to be user-facing in general (e.g. app on top should catch it). Unlike to goodtables where all error messages are intended to be user-facing.

So looking forward to your comments. We still have some reserves to improve some messages more (investing more time). Just looking forward to hear what's blockers/priorities. We could handle it in this PR or open individual issue for every new requested improvement.

cc @pwalsh

roll commented 7 years ago

List of all data related exceptions:

Stephen-Gates commented 7 years ago

@roll I will have a good look over the weekend.

Stephen-Gates commented 7 years ago

@roll

Ideally the row and column for each error would be reported. This would enable Data Curator to:

If this is not possible, then returning the row in error would enable the row to be highlighted.

In terms of priority:

  1. Type and Format
  2. Constraint
  3. Foreign Key
  4. Structure

I'll add a feature request and comment separately on error message wording.

roll commented 7 years ago

@Stephen-Gates That's what I was thinking for. Error messages may be are not the best thing to rely on. But the lib could provide an API for error context when possible e.g:

Than it could be re-used in the higher-level app (including an ability to compose a message using data quality spec). I think it could be more reliable way to achieve the same goal.

Stephen-Gates commented 7 years ago

Sounds like a good approach @roll

Stephen-Gates commented 7 years ago

@roll sorry for the delay. Assuming no other variables are available for use in the error messages, then...

Type or Format Error

The value "${value}" in column "${this.name}" is not type "${this.type}" and format "${this.format}" appears to be as close as you can get to the Type or Format DQS error message in DQS.

Constraint Error

To better match the format of most constraint error messages in DQS, I suggest Field "${this.name}" has constraint "${name}" which is not satisfied for value "{value}" is rewritten to, The value "{value}" does not conform to the "${name}" constraint for field "${this.name}"

Extra / Missing Value

There's no equivalent message in DQS. The closest is the extra/missing value error messages in DQS that compares the row length to the header row. This error appears to be comparing the row length to the number of fields in the schema.

I suggest Row length ${row.length} doesn't match fields count ${this.fields.length} is rewritten to, The row with ${row.length} columns does not match the ${this.fields.length} fields in the schema

Perhaps columns should be values?

Non-matching Header

To better match the format of most non-matching header error message in DQS, I suggest Table headers don\'t match schema field names is rewritten to, The column header names do not match the field names in the schema

Unique constraint

Row ${rowNumber} has unique constraint violation in column "${cache.name}"

edit that should be applied to DQS and here,

Row ${rowNumber} has a unique constraint violation in column "${cache.name}"

Foreign key

Not implemented in DQS (although there is a suggestion). I don't think I can improve Foreign key "${foreignKey.fields}" violation in row ${rowNumber}

I did consider:

roll commented 7 years ago

@Stephen-Gates Thanks. It's just a great help.

roll commented 7 years ago

@Stephen-Gates Please take a look. I've:

Stephen-Gates commented 7 years ago

@roll will review this week. thanks.

roll commented 7 years ago

@Stephen-Gates Thanks! I've fixes the last one.