diff --git a/headless_client/worker_world.coffee b/headless_client/worker_world.coffee index 667481858..1680b86aa 100644 --- a/headless_client/worker_world.coffee +++ b/headless_client/worker_world.coffee @@ -137,20 +137,18 @@ work = () -> self.onWorldError = onWorldError = (error) -> - self.postMessage type: "end-load-frames" - if error instanceof Aether.problems.UserCodeProblem - #console.log "Aether userCodeProblem occured." - unless self.postedErrors[error.key] - problem = error.serialize() + if error.isUserCodeProblem + errorKey = error.userInfo.key + if not errorKey or not self.postedErrors[errorKey] self.postMessage type: "user-code-problem" - problem: problem - - self.postedErrors[error.key] = problem + problem: error + self.postedErrors[errorKey] = error else console.log "Non-UserCodeError:", error.toString() + "\n" + error.stack or error.stackTrace - self.cleanUp() - + self.cleanUp() + return true + self.onWorldLoadProgress = onWorldLoadProgress = (progress) -> #console.log "Worker onWorldLoadProgress" self.postMessage diff --git a/scripts/transpile.coffee b/scripts/transpile.coffee index 5b4794b4c..2c60a1c91 100644 --- a/scripts/transpile.coffee +++ b/scripts/transpile.coffee @@ -13,19 +13,23 @@ Aether.addGlobal 'Vector', require '../app/lib/world/vector' Aether.addGlobal '_', _ transpileLevelSession = (sessionID, cb) -> - query = LevelSession.findOne("_id": sessionID).select("submittedCode").lean() + query = LevelSession.findOne("_id": sessionID).select("submittedCode submittedCodeLanguage").lean() query.exec (err, session) -> if err then return cb err submittedCode = session.submittedCode + unless session.submittedCodeLanguage + throw "SUBMITTED CODE LANGUAGE DOESN'T EXIST" + else + console.log "Transpiling code for session #{session._id} in language #{session.submittedCodeLanguage}" transpiledCode = {} - console.log "Updating session #{sessionID}" + #console.log "Updating session #{sessionID}" for thang, spells of submittedCode transpiledCode[thang] = {} for spellID, spell of spells aetherOptions = problems: {} - language: "javascript" + language: session.submittedCodeLanguage functionName: spellID functionParameters: [] yieldConditionally: spellID is "plan" @@ -41,7 +45,6 @@ transpileLevelSession = (sessionID, cb) -> "_id": sessionID update = "transpiledCode": transpiledCode - "submittedCodeLanguage": "javascript" query = LevelSession.update(conditions,update) query.exec (err, numUpdated) -> cb err