mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 15:02:52 -05:00
scratch-parser expects json string...
This commit is contained in:
parent
59d1c2a0b3
commit
7c7b016643
1 changed files with 3 additions and 1 deletions
|
@ -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)}`;
|
||||||
|
|
Loading…
Reference in a new issue