JSFiddle - React, Tailwind, and code Playground

by Artem

JavaScript

'use strict';

class FormatError extends SyntaxError {
	constructor() {}
}
let err = new FormatError("formatting error");

console.log( err.message ); // formatting error
console.log( err.name ); // FormatError
console.log( err.stack ); // stack

console.log( err instanceof FormatError ); // true
console.log( err instanceof SyntaxError ); // true (because inherits from SyntaxError