Commit a8ca17dd authored by Boxiang Sun's avatar Boxiang Sun

erp5_notebook: Remove error handling, let the notebook failed asap

parent b9f825f3
...@@ -91,11 +91,7 @@ ...@@ -91,11 +91,7 @@
// New type detexted // New type detexted
if (next_type[1] === 'code') { if (next_type[1] === 'code') {
// language detected // language detected
try { language_type = JSON.parse(current_line.match(language_type_regexp)).language;
language_type = JSON.parse(current_line.match(language_type_regexp)).language;
} catch (e) {
throw e;
}
next_type[1] = next_type[1] + '_' + language_type; next_type[1] = next_type[1] + '_' + language_type;
} }
pushNewCell(); pushNewCell();
...@@ -299,12 +295,8 @@ ...@@ -299,12 +295,8 @@
function executePyCell(line_list) { function executePyCell(line_list) {
var result_text, code_text = line_list.join('\n'); var result_text, code_text = line_list.join('\n');
try { result_text = pyodide.runPython(code_text);
result_text = pyodide.runPython(code_text); renderCodeblock(result_text);
} catch (e) {
result_text = e.message;
}
renderCodeblock(result_text, 'python');
} }
function pyodideSetting() { function pyodideSetting() {
...@@ -350,27 +342,21 @@ ...@@ -350,27 +342,21 @@
if (!is_pyodide_loaded) { if (!is_pyodide_loaded) {
console.log("Loading pyodide"); console.log("Loading pyodide");
queue.push(function () { queue.push(function () {
console.log("Loading webassembly module");
Module.instantiateWasm = loadPyodide; Module.instantiateWasm = loadPyodide;
window.Module = Module; window.Module = Module;
}) })
.push(function () { .push(function () {
console.log("Loading pyodide.asm.data.js");
return loadJSResource('pyodide.asm.data.js'); return loadJSResource('pyodide.asm.data.js');
}) })
.push(function () { .push(function () {
console.log("Loading pyodide.asm.js");
return loadJSResource('pyodide.asm.js'); return loadJSResource('pyodide.asm.js');
}) })
.push(function () { .push(function () {
console.log("Prepare to set postRun and pyodide");
return pyodideSetting(); return pyodideSetting();
}); });
is_pyodide_loaded = true; is_pyodide_loaded = true;
} }
console.log("Fuck!");
queue.push(function () { queue.push(function () {
console.log("Executing Python cell");
return executePyCell(cell._line_list); return executePyCell(cell._line_list);
}); });
return queue; return queue;
...@@ -401,11 +387,6 @@ ...@@ -401,11 +387,6 @@
console.info('JSMD executed.'); console.info('JSMD executed.');
}, function (error) { }, function (error) {
console.error(error); console.error(error);
// do not print the error page with a non-styled pre tag
// the Python error message will be displayed along with Python source code in above
if (error.message.startsWith('Traceback')) {
return;
}
var pre = document.createElement('pre'); var pre = document.createElement('pre');
pre.textContent = error; pre.textContent = error;
document.body.appendChild(pre); document.body.appendChild(pre);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment