spago
spago copied to clipboard
spago.yaml json errors could be a bit smaller
❌ Couldn't parse Spago config, error:
An error occurred while decoding a JSON value:
Under 'Config':
At object key package:
Under 'PackageConfig':
At object key publish:
Under 'PublishConfig':
At object key license:
No value was found.
Instead:
Missing the following value: package - publish - license
By the way for location the error is much nicer
Need to specify a publish.location field.
So i guess for license it could be
Need to specify a publish.license field.
but for both i would make it the full path:
Need to specify a package.publish.license field.
And I'm not sure if grammatically it's a full sentence (verb need without subject who?), some alternatives:
Specify a package.publish.license field.
You need to specify a package.publish.license field.
Please specify a package.publish.license field.
A package.publish.license field needs to be specified.
A package.publish.license field needs to be given.
package.publish.license is missing, please specify it.
"Json errors" is unfortunately not a simple problem to solve.
We parse the Yaml through Argonaut, which returns us a JsonDecodeError - right now we are using the default renderer to print out the errors, and things could be improved by:
- writing our custom renderer so that we improve errors in general
- or pattern matching on a specific error so we can give even more detailed instructions
I'm not likely to get to this myself soon, but I'd love to merge a contribution for this