You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, today I was hunting for a bug during serializing JSON into YAML. I was getting unacceptable kind of an object to dump [object Undefined] but there was no undefined in the JSON. After an hour I was able to find the cause and it was this fragment 1: [null] in the JSON below:
thrownewYAMLException('unacceptable kind of an object to dump '+type);
The JSON was much bigger and nested that is why it was not easy. But I would like to ask for a better error message so it will be much easier in the future. Would be nice to write the path to the invalid value. For example like this unacceptable kind of an object to dump at path.to.object.START.CALL.0."1".0. Got: ${type}.
I didn't go deeply into the code but if this is possible to get and if you are OK with it I can even try to implement it and send PR.
Thanks for the answer and have a nice day :)
The text was updated successfully, but these errors were encountered:
I didn't go deeply into the code but if this is possible to get and if you are OK with it I can even try to implement it and send PR.
You can try. Unfortunately, I don't think path to the object is stored anywhere at the moment. Adding it might be a hard task and can run into performance issues.
Hello, today I was hunting for a bug during serializing JSON into YAML. I was getting
unacceptable kind of an object to dump [object Undefined]
but there was noundefined
in the JSON. After an hour I was able to find the cause and it was this fragment1: [null]
in the JSON below:The relevant code is at
js-yaml/lib/js-yaml/dumper.js
Line 779 in 86aabf1
The JSON was much bigger and nested that is why it was not easy. But I would like to ask for a better error message so it will be much easier in the future. Would be nice to write the path to the invalid value. For example like this unacceptable kind of an object to dump at
path.to.object.START.CALL.0."1".0
. Got: ${type}.I didn't go deeply into the code but if this is possible to get and if you are OK with it I can even try to implement it and send PR.
Thanks for the answer and have a nice day :)
The text was updated successfully, but these errors were encountered: