toString < Error < JavaScript
Error objects are thrown when runtime errors occur. The toString() method of the Error object returns a string representing this error.
const error = new Error("fatal error");
console.log(error)
// [object Error] { ... }
console.log(error.toString());
// "Error: fatal error"