JavaScript Error Methods

Beginner
4 min read
Updated: Nov 2026
3 method guides
Method index

About This Index

This page is the JavaScript Error Methods index. The Error object has three methods. Each row below links to a full guide with syntax, examples you can run, and FAQs.

Learn what an Error is on /js/error. Use this page when you need a specific method such as toString().

Two static methods and one instance method.

Error.captureStackTrace() and Error.isError() are called on the Error constructor itself. toString() is called on an error object, for example err.toString().

How to Call an Error Method

Call the static methods on Error and the instance method on an error object:

JavaScript
const err = new Error("Disk full");

// instance method: call it on an error object
err.toString();                    // "Error: Disk full"

// static methods: call them on Error itself
Error.isError(err);                // true
Error.isError("Disk full");        // false

const report = { name: "ReportError", message: "Report failed" };
Error.captureStackTrace(report);   // report.stack is now a string

JavaScript Error Methods Table

All method guides in this JavaScript tutorial series (3 tutorials), grouped by what they do.

Static methods (call on Error)

2 methods

Helpers you call on the Error constructor itself, not on an error object.

MethodDescriptionTutorial
Error.captureStackTrace()Add a stack property to any object, and hide a helper function from it with the second argument.Open
Error.isError()Return true when a value is a real Error object; more reliable than instanceof Error.Open

Instance method (call on an error object)

1 method

Available on every error you create or catch.

MethodDescriptionTutorial
toString()Return one line of text, name: message. JavaScript calls it for you in String(err) and in "text" + err.Open

Frequently Asked Questions

Three: Error.captureStackTrace() and Error.isError() are static methods you call on Error itself, and toString() is an instance method available on every error. Errors also have the properties name, message, stack and cause.
The Error page explains the idea: throw, try...catch, the built-in error types and custom errors, with beginner examples. This index lists the method guides so you can jump straight to the one you need.
Error.captureStackTrace() and Error.isError(). You write them with the word Error in front, and you do not need an error object. toString() is different: you call it on an error, as in err.toString().
toString() has been standard for a very long time. Error.isError() is a newer standard method, so check browser support. Error.captureStackTrace() is a V8 feature, not part of the standard, so check that it exists before you use it.
Start with toString(), because it is the simplest and works everywhere. Then read Error.isError() to learn how to check what a catch block received, and Error.captureStackTrace() when you build your own error classes.

Start with toString()

Open the guide for turning an error into readable text: syntax, examples, and FAQs.

toString() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

10 people found this page helpful