When a script rises an error, Surge print out details of error including lineNumber and columnNumber. Of course, the connection then was aborted.
Using try...catch will help us handle the error and withdraw the script from connection. I can only get the message from the error. I want to know the lineNumber and columnNumber but it is an undefined value. Please help me.
This is an example code
try {
console.log(string);
} catch (err) {
console.log("Message: " + err.message);
console.log("Line number: " + err.lineNumber);
}
Out put:
Message: Can't find variable: string
Line number: undefined