SyntaxError
The SyntaxError constructor creates a new error object
that represents an error when trying to interpret syntactically invalid code.
Syntax
new SyntaxError()
new SyntaxError(message)
new SyntaxError(message, options)
new SyntaxError(message, fileName)
new SyntaxError(message, fileName, lineNumber)
SyntaxError()
SyntaxError(message)
SyntaxError(message, options)
SyntaxError(message, fileName)
SyntaxError(message, fileName, lineNumber)
Note:
SyntaxError()can be called with or withoutnew. Both create a newSyntaxErrorinstance.
Parameters
messageoptional- : Human-readable description of the error
optionsoptional- : An object that has the following properties:
causeoptional- : A property indicating the specific cause of the error. When catching and re-throwing an error with a more-specific or useful error message, this property can be used to pass the original error.
- : An object that has the following properties: