Handle partial error location information

We might not get line or column number, but the file is still
useful information.
This commit is contained in:
Pierre Ossman 2017-03-02 15:44:30 +01:00
parent 5da03103a3
commit 732233eda0
1 changed files with 9 additions and 3 deletions

View File

@ -21,10 +21,16 @@
div.appendChild(document.createTextNode(event.message));
msg.appendChild(div);
if (event.filename !== undefined && event.lineno !== undefined && event.colno !== undefined) {
if (event.filename) {
div = document.createElement("div");
div.className = 'noVNC_location';
const text = event.filename + ":" + event.lineno + ":" + event.colno;
var text = event.filename;
if (event.lineno !== undefined) {
text += ":" + event.lineno;
if (event.colno !== undefined) {
text += ":" + event.colno;
}
}
div.appendChild(document.createTextNode(text));
msg.appendChild(div);
}