frictionlessdata / tableschema-js

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

Provide more fields in TableSchemaError #147

Open ffflabs opened 6 years ago

ffflabs commented 6 years ago

As said in README.md

There is a missingValues property in Table Schema specification. As a first try we set missingValues to N/A in table.schema.descriptor

It would be nice if TableSchemaError, instead of having attributes:

{
message: 'The value "N/A" in column "geometry" is not type "geojson" and format "topojson"',
columnNumber: 10,
rowNumber: 5
}

could have:

{
message: 'The value "N/A" in column "geometry" is not type "geojson" and format "topojson"',
columnNumber: 10,
rowNumber: 5,
offendingValue: 'N/A',
column: 'geometry',
expectedType: 'geojson',
expectedFormat: 'topojson'
}

(honestly, offendingValue would be enough)

Currently, if I want to add offending values to missingValues I have to do a regex on TableSchemaError.message.