Update VM to use scratch-parser callback interface

This commit is contained in:
Karishma Chadha 2018-03-15 22:40:40 -04:00
parent a3ed4cad99
commit 003ed01015

View file

@ -190,7 +190,18 @@ class VirtualMachine extends EventEmitter {
// Clear the current runtime
this.clear();
return validate(input)
const validationPromise = new Promise((resolve, reject) => {
validate(input, (error, res) => {
if (error) {
reject(error);
}
if (res) {
resolve(res);
}
});
});
return validationPromise
.then(validatedInput => this.deserializeProject(validatedInput[0], validatedInput[1]))
.catch(error => {
// Intentionally rejecting here (want errors to be handled by caller)