publiccode-editor
publiccode-editor copied to clipboard
Expose verbose error on duplicate key in uploaded publiccode.yml
Subject of the issue
When a publiccode.yml file containing at least one duplicated key is uploaded, the editor throws an error saying Parsing error
.
Steps to reproduce
Upload a publiccode.yml containing a duplicate key.
Expected behaviour
The js-yaml
library has 2 possible load functions: load
and safeLoad
. First of all, I believe we should switch to safeLoad
since it's recommended when dealing with untrusted sources. Then, safeLoad
raises an Exception which we should catch and, when possible, expose the relevant error. In this particular case, the error should not be generic but it should say Parsing error: duplicate key found
or something like that.
Actual behaviour
A generic error is shown and it's not possible to continue.