Bug 83437

Summary: Command-line jsc's exception handling should be rationalized
Product: WebKit Reporter: Filip Pizlo <fpizlo>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
the patch mitz: review+

Description Filip Pizlo 2012-04-08 13:10:01 PDT
Currently it will swallow and ignore exceptions thrown during a run() execution.  If a program terminates because of an exception, the exception is not printed by default.  It is only printed if we enable bytecode dumping.  It should be enabled always.  The backtrace is never printed even though we almost always have one.
Comment 1 Filip Pizlo 2012-04-08 13:15:58 PDT
Created attachment 136156 [details]
the patch
Comment 2 mitz 2012-04-08 13:45:21 PDT
Comment on attachment 136156 [details]
the patch

View in context: https://bugs.webkit.org/attachment.cgi?id=136156&action=review

> Source/JavaScriptCore/jsc.cpp:532
>          if (dump) {
> -            if (evaluationException)
> -                printf("Exception: %s\n", evaluationException.toString(globalObject->globalExec())->value(globalObject->globalExec()).utf8().data());
> -            else
> +            if (!evaluationException)

Now that there’s no else clause inside you can just write
    if (dump && !evaluationException)
Comment 3 Filip Pizlo 2012-04-08 13:46:19 PDT
(In reply to comment #2)
> (From update of attachment 136156 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=136156&action=review
> 
> > Source/JavaScriptCore/jsc.cpp:532
> >          if (dump) {
> > -            if (evaluationException)
> > -                printf("Exception: %s\n", evaluationException.toString(globalObject->globalExec())->value(globalObject->globalExec()).utf8().data());
> > -            else
> > +            if (!evaluationException)
> 
> Now that there’s no else clause inside you can just write
>     if (dump && !evaluationException)

Good point, thanks for the review!
Comment 4 Filip Pizlo 2012-04-08 13:51:21 PDT
Landed in http://trac.webkit.org/changeset/113553