validate now returns {valid, errors} object instead of throwing errors which was not a javascript approach
normalized throwing errors across the whole library. Now only DataPackageError could be raised (not error, array of errors or even array of strings as it was). If there are multiple errors an interface is predictable now:
try {
// some lib action
} catch (error) {
console.log(error) // you have N cast errors (see error.errors)
if (error.multiple) {
for (const error of error.errors) {
console.log(error) // cast error M is ...
}
}
}
It contains two main updates:
validate
now returns{valid, errors}
object instead of throwing errors which was not a javascript approachDataPackageError
could be raised (not error, array of errors or even array of strings as it was). If there are multiple errors an interface is predictable now: