Error
The Error() constructor creates an error object.
Syntax
new Error()
new Error(message)
new Error(message, options)
new Error(message, fileName)
new Error(message, fileName, lineNumber)
Error()
Error(message)
Error(message, options)
Error(message, fileName)
Error(message, fileName, lineNumber)
Note:
Error()can be called with or withoutnew. Both create a newErrorinstance.
Parameters
messageoptional- : A human-readable description of the error.
optionsoptional- : An object that has the following properties:
causeoptional- : A value indicating the specific cause of the error, reflected in the
Error.prototype.causeproperty. 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.
- : A value indicating the specific cause of the error, reflected in the
- : An object that has the following properties: