Skip to content

Uncaught SyntaxError: Invalid or unexpected token #4

@zdooder

Description

@zdooder

Trying to save an APEX class with a syntax error results in no error message and failure to save. Opening the browser's javascript console shows:

Uncaught SyntaxError: Invalid or unexpected token
    at Object.success (d3vCode.js?v=1.0.2:4005)
    at n (jquery.min.js?v=1.0.2:2)
    at Object.fireWith [as resolveWith] (jquery.min.js?v=1.0.2:2)
    at w (jquery.min.js?v=1.0.2:4)
    at XMLHttpRequest.d (jquery.min.js?v=1.0.2:4)

The "Network" tab of the browser's developer tools shows the actual return value from Salesforce:

{ "bodyCrc" : "","column" : "18","Id" : "","line" : "178","Name" : "AcctFinancialHistoryController","problem" : "Unrecognized symbol '"', which is not a valid Apex identifier.","success" : "false","warnings" : ""}

The actual problem in the class is that double-quotes were used around a string literal instead of single quotes. I suspect that a parser is failing to parse the error with the mixed (and unbalanced) quotation marks?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions