frictionlessdata / datapackage-js

A JavaScript library for working with Data Package.
http://frictionlessdata.io/
MIT License
42 stars 15 forks source link

Improving error messages #95

Open ghost opened 6 years ago

ghost commented 6 years ago

Hi When using the data package validation, there are error messages that seem unclear. It would be great if these could be made more specific (ie: hone in on what the, say, the index in resources descriptor refers to). As an example, in leaving out the 'name' field in Resource, the top of error stack comes back as: Descriptor validation error: Missing required property: resources at "" in descriptor and at "/required/0" in profile at "" in descriptor and at "/required/0" in profile at Profile.validate ... datapackage/lib/profile.js:41 @Stephen-Gates, you might be able to phrase this better than I can?

Stephen-Gates commented 6 years ago

Thanks @mattRedBox, if I understand correctly, the validation error returned is difficult to understand the error without looking into the code.

I looked through the source files and I think most of the error messages are pretty good except for the one you point out.

The error is a data resource that doesn't have a name but every resource must have a name as required by the profile.

So:

It would be helpful for the error message to say that name is required in a resource

Is that a good summary?