Merge branch 'master' into production

This commit is contained in:
Nick Winter 2014-05-26 19:13:16 -07:00
commit b21f14f0b5
3 changed files with 19 additions and 2 deletions

View file

@ -266,7 +266,6 @@ self.enableFlowOnThangSpell = function (thangID, spellID, userCodeMap) {
self.setupDebugWorldToRunUntilFrame = function (args) {
self.debugPostedErrors = {};
self.debugt0 = new Date();
self.debugPostedErrors = false;
self.logsLogged = 0;
var stringifiedUserCodeMap = JSON.stringify(args.userCodeMap);
@ -324,7 +323,6 @@ self.debugAbort = function () {
self.runWorld = function runWorld(args) {
self.postedErrors = {};
self.t0 = new Date();
self.postedErrors = false;
self.logsLogged = 0;
try {
@ -394,6 +392,7 @@ self.onWorldError = function onWorldError(error) {
}
else {
console.log("Non-UserCodeError:", error.toString() + "\n" + error.stack || error.stackTrace);
self.postMessage({type: 'non-user-code-problem', problem: {message: error.toString()}});
}
/* We don't actually have the recoverable property any more; hmm
if(!error.recoverable) {

View file

@ -71,6 +71,14 @@ module.exports = class Angel extends CocoClass
when 'user-code-problem'
Backbone.Mediator.publish 'god:user-code-problem', problem: event.data.problem
# We have to abort like an infinite loop if we see one of these; they're not really recoverable
when 'non-user-code-problem'
Backbone.Mediator.publish 'god:non-user-code-problem', problem: event.data.problem
if @shared.firstWorld
@infinitelyLooped() # For now, this should do roughly the right thing if it happens during load.
else
@fireWorker()
# Either the world finished simulating successfully, or we abort the worker.
when 'new-world'
@beholdWorld event.data.serialized, event.data.goalStates

View file

@ -35,6 +35,7 @@ module.exports = class SpellView extends View
'surface:coordinate-selected': 'onCoordinateSelected'
'god:new-world-created': 'onNewWorld'
'god:user-code-problem': 'onUserCodeProblem'
'god:non-user-code-problem': 'onNonUserCodeProblem'
'tome:manual-cast': 'onManualCast'
'tome:reload-code': 'onCodeReload'
'tome:spell-changed': 'onSpellChanged'
@ -441,9 +442,18 @@ module.exports = class SpellView extends View
@lastUpdatedAetherSpellThang = null # force a refresh without a re-transpile
@updateAether false, false
onNonUserCodeProblem: (e) ->
return unless @spellThang
problem = @spellThang.aether.createUserCodeProblem type: 'runtime', kind: 'Unhandled', message: "Unhandled error: #{e.problem.message}"
@spellThang.aether.addProblem problem
@spellThang.castAether?.addProblem problem
@lastUpdatedAetherSpellThang = null # force a refresh without a re-transpile
@updateAether false, false # TODO: doesn't work, error doesn't display
onInfiniteLoop: (e) ->
return unless @spellThang
@spellThang.aether.addProblem e.problem
@spellThang.castAether?.addProblem e.problem
@lastUpdatedAetherSpellThang = null # force a refresh without a re-transpile
@updateAether false, false