When loading a script using WebView.stringByEvaluatingJavaScriptFromString that contains syntax errors, the script is not loaded at all and no error is returned. I set up my WebView's context like this to report errors:
let context = view.mainFrame.javaScriptContext;
context.setObject(false, forKeyedSubscript: "JSError");
context.exceptionHandler = { context, exception in
self.logIntern("JS Error: " + exception.toString());
context.setObject(true, forKeyedSubscript: "JSError");
}
This reporting works nicely for runtime errors, but not parse errors. How can I know that parsing my script failed (maybe including parsing info, like error type and line number)?