From 7c72a4efe48149c20b9a3e8bb7e547214301a9f3 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Tue, 1 Mar 2016 20:51:25 +0100 Subject: Remove the commError wrapper function --- js/codeq/prolog.js | 7 ++----- js/codeq/python.js | 11 ++++------- js/codeq/robot.js | 7 ++----- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/js/codeq/prolog.js b/js/codeq/prolog.js index 1be339f..7da12e2 100644 --- a/js/codeq/prolog.js +++ b/js/codeq/prolog.js @@ -177,10 +177,7 @@ along with this program. If not, see . */ }), activityHandler = codeq.makeActivityHandler(editor, problemDef.id), terminal = makePrologTerminalHandler(jqTerminal, editor, problemDef.id, activityHandler), - hinter = codeq.makeHinter(jqHints, jqEditor, editor, 'prolog_hints', problemDef, commonDef, activityHandler), - commError = function (error) { - alert(error); - }; + hinter = codeq.makeHinter(jqHints, jqEditor, editor, 'prolog_hints', problemDef, commonDef, activityHandler); codeq.template.processDictionary(problemDef.translations.description, [problemDef.language, problemDef.group, problemDef.problem]); @@ -241,7 +238,7 @@ along with this program. If not, see . */ terminal.append(data.message + '\n', 'error'); } }) - .fail(commError) + .fail(alert) .fin(function () { editor.setOption('readOnly', false); $(editor.getWrapperElement()).removeClass('disabled'); diff --git a/js/codeq/python.js b/js/codeq/python.js index 9fc34c8..055ada7 100644 --- a/js/codeq/python.js +++ b/js/codeq/python.js @@ -117,10 +117,7 @@ along with this program. If not, see . */ }), activityHandler = codeq.makeActivityHandler(editor, problemDef.id), terminal = makePythonTerminalHandler(jqTerminal, editor, problemDef.id, activityHandler), - hinter = codeq.makeHinter(jqHints, jqEditor, editor, 'python_hints', problemDef, commonDef, activityHandler), - commError = function (error) { - alert(error); - }; + hinter = codeq.makeHinter(jqHints, jqEditor, editor, 'python_hints', problemDef, commonDef, activityHandler); codeq.template.processDictionary(problemDef.translations.description, [problemDef.language, problemDef.group, problemDef.problem]); @@ -175,7 +172,7 @@ along with this program. If not, see . */ terminal.append('error: ' + data.message); } }) - .fail(commError) + .fail(alert) .fin(function () { editor.setOption('readOnly', false); $(editor.getWrapperElement()).removeClass('disabled'); @@ -193,7 +190,7 @@ along with this program. If not, see . */ 'program': program }); }) - .fail(commError) + .fail(alert) .done(); // focus the terminal jqTerminal.click(); @@ -201,7 +198,7 @@ along with this program. If not, see . */ jqBtnStop.on('click', function () { activityHandler.queueTrace({'typ': 'python_stop'}); codeq.comms.sendPythonStop({}) - .fail(commError) + .fail(alert) .done(); }); diff --git a/js/codeq/robot.js b/js/codeq/robot.js index 4222d0b..8512df7 100644 --- a/js/codeq/robot.js +++ b/js/codeq/robot.js @@ -93,9 +93,6 @@ along with this program. If not, see . */ activityHandler = codeq.makeActivityHandler(editor, problemDef.id), terminal = makeRobotTerminalHandler(jqTerminal, editor, problemDef.id, activityHandler), hinter = codeq.makeHinter(jqHints, jqEditor, editor, 'robot_hints', problemDef, commonDef, activityHandler), - commError = function (error) { - alert(error); - }, reconnectTimer = null, url = 'ws://' + codeq.settings['robot_address'] + ':8000/', socket = eio(url); @@ -169,10 +166,10 @@ along with this program. If not, see . */ hinter.handle(data.hints); } else { - commError('error: ' + data.message); + alert('error: ' + data.message); } }) - .fail(commError) + .fail(alert) .fin(function () { editor.setOption('readOnly', false); $(editor.getWrapperElement()).removeClass('disabled'); -- cgit v1.2.1