Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: Returning syntax error location

0
0
Hi ZoneRunner,

Thanks for posting your sample code!

The detail text of exception 1 does appear to be formatted incorrectly. When V8 initially reports the syntax error, ClearScript is confused by the presence of a stack trace, since script code with syntax errors isn't executable. ClearScript's assumption is incorrect in cases involving nested invocations of the script engine.

The outer exception (exception 2) is correct, however. The syntax error passes through the host, where it's wrapped in a host exception, and as is the case with all host exceptions, it's passed back to the outer script frame as a JavaScript object of type Error, whose constructor adds the "Error: " prefix.

ClearScript's next point release will include a fix for the formatting of the inner exception's detail text. With the fix, the inner exception will look exactly as you suggest; its detail text will include the location of the syntax error as well as the stack traces of any outer script frames.

Thanks again!

Viewing all articles
Browse latest Browse all 2297

Latest Images

Trending Articles





Latest Images