en.javascript.info/1-js/08-error-handling/2-custom-errors/1-format-error/task.md
Ilya Kantor a7c00e1c76 up
2017-01-18 09:53:11 +01:00

337 B

importance: 5


Inherit from SyntaxError

Create an error FormatError that inherits from SyntaxError.

Usage example:

let err = new FormatError("formatting error");

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

alert( err instanceof SyntaxError ); // true