Skip to content

Commit 4b75d43

Browse files
committed
forgot new way of handeling bugs in player.js
1 parent 87af6d1 commit 4b75d43

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

client/scripts/game/player.js

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,17 @@
141141
storage["py_game_src"] = src;
142142
}
143143
Debugger.unset_events();
144-
Debugger.run_to_end(src);
144+
var hist = Debugger.run_to_end(src);
145145
Debugger.reset_events();
146146
Game.can_draw(true);
147147
Game.game.draw();
148+
if(hist.error) {
149+
var state = hist.errorState;
150+
doc('console').value = state.data;
151+
state.message = state.name+": "+state.message;
152+
state.severity = 'error';
153+
editor.updateLinting(CodeMirror.lintResult([state]));
154+
}
148155
}
149156

150157
function start_debugger(ev) {
@@ -226,17 +233,20 @@
226233
} else {
227234
doc('back').disabled = false;
228235
}
236+
237+
if(state.err) {
238+
doc('console').value = state.data;
239+
state.message = state.name+": "+state.message;
240+
state.severity = 'error';
241+
editor.updateLinting(CodeMirror.lintResult([state]));
242+
} else {
243+
clearLint()
244+
}
229245
}
230246

231247

232248
function debug_error(err, Debugger) {
233-
if (Debugger.get_recorded_states().length === 0) {
234-
doc('console').value = err.data;
235-
Debugger.stop_debugger();
236-
}
237-
err.severity = 'error';
238249

239-
editor.updateLinting(CodeMirror.lintResult([err]));
240250
}
241251

242252
function reset_game_state() {

0 commit comments

Comments
 (0)