scratch-parser expects json string...

This commit is contained in:
Karishma Chadha 2018-02-28 11:52:22 -05:00
parent 59d1c2a0b3
commit 7c7b016643

View file

@ -245,7 +245,9 @@ class VirtualMachine extends EventEmitter {
deserializer = sb3; deserializer = sb3;
validatedProject = possibleSb3; validatedProject = possibleSb3;
} else { } else {
validate(json, (err, project) => { // scratch-parser expects a json string or a buffer
const possibleSb2 = typeof json === 'object' ? JSON.stringify(json) : json;
validate(possibleSb2, (err, project) => {
if (err) { if (err) {
const errorMessage = const errorMessage =
`The given project could not be validated, parsing failed with error: ${JSON.stringify(err)}`; `The given project could not be validated, parsing failed with error: ${JSON.stringify(err)}`;