Skip to main content
Version: 3.7.0


The Error() constructor creates an error object.


new Error()
new Error(message)
new Error(message, options)
new Error(message, fileName)
new Error(message, fileName, lineNumber)

Error(message, options)
Error(message, fileName)
Error(message, fileName, lineNumber)

Note: Error() can be called with or without new. Both create a new Error instance.


  • message optional
    • : A human-readable description of the error.
  • options optional
    • : An object that has the following properties:
      • cause optional
        • : A value indicating the specific cause of the error, reflected in the Error.prototype.cause property. 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.