JavaScript Syntax Errors

JavaScript syntax errors occur when the structure of one of your JavaScript statements violates one or more of the syntactic rules.

Errors

Error Number Description
1019 Can't have 'break' outside of loop
1020 Can't have 'continue' outside of loop
1030 Conditional compilation is turned off
1027 'default' can only appear once in a 'switch' statement
1005 [Expected '('](../../javascript/misc/expected-left-parenthesis-javascript.md
1006 [Expected ')'](../Topic/Expected%20')'%20(JavaScript).md)
1012 Expected '/'
1003 Expected ':'
1004 Expected ';'
1032 Expected '@'
1029 Expected '@end'
1007 Expected ']'
1008 Expected '{'
1009 Expected '}'
1011 Expected '='
1033 Expected 'catch'
1031 Expected constant
1023 Expected hexadecimal digit
1010 Expected identifier
1028 Expected identifier, string or number
1024 Expected 'while'
1014 Invalid character
1026 Label not found
1025 Label redefined
1018 'return' statement outside of function
1002 Syntax error
1035 Throw must be followed by an expression on the same source line
1016 Unterminated comment
1015 Unterminated string constant

Script Host Errors

The following errors are properly speaking errors pertaining to the script host, but you may see them occasionally.

Error HRESULT Description
SCRIPT_E_RECORDED 0x86664004 An error has been recorded to be passed between script engine and host. The host needs to pass the error code to the caller.
SCRIPT_E_REPORTED 0x80020101 Script engine has reported an unhandled exception to the host via IActiveScriptSite::OnScriptError. Host can ignore this error.
SCRIPT_E_PROPAGATE 0x8002010 A script error is being propagated to the caller which might be in a different thread. The host should pass the error code to the caller.

See Also

JavaScript Run-time Errors