agjaeger / CodeBin

CodeBin - an online IDE and compiler with a file server attached
Apache License 2.0
0 stars 1 forks source link

Skulpt Error Messages #2

Closed agjaeger closed 10 years ago

agjaeger commented 10 years ago

Since Skulpt is Python that is interpreted with JavaScript, error messages do not transfer to the end user and leaves the output div empty.

In order to fix, either a different library or a Virtual Machine Spawner is required

cptaffe commented 10 years ago

It seems Skulpt stores errors in an Sk.builtin.Exception object, as explained in the comment atop this file: errors.js

The filename, line number, and column number of exceptions are stored within the exception object. Note that not all exceptions clearly report the column number. To customize the exception message to use any/all of these fields, you can either modify tp$str below to print the desired message, or use them in the skulpt wrapper (i.e., runit) to present the exception message.

It seems it already prints errors to the console, and the errors.js file indicates this might work in the example gist within runit()

document.getElementById("errorout").value = Sk.builtin.Exception.toString();