[Webkit-unassigned] [Bug 203478] New: Poor Async/Await Syntax Error Message

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Oct 27 19:47:38 PDT 2019


https://bugs.webkit.org/show_bug.cgi?id=203478

            Bug ID: 203478
           Summary: Poor Async/Await Syntax Error Message
           Product: WebKit
           Version: Safari 13
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: ezekielelin at me.com

The `await` keyword can only be used in functions marked `async.` When one tries to use it in a function not marked as such, evaluation fails with the error:

    function b() {
      const x = await "Hello";
    }

    SyntaxError: Unexpected string literal "Hello". Expected ';' after variable declaration.

This should instead say something like (copied from Firefox):

    SyntaxError: await is only valid in async functions and async generators

The correct code is:

    async function b() {
      const x = await "Hello";
    }

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20191028/6ece4320/attachment.htm>


More information about the webkit-unassigned mailing list