This commit is contained in:
Ilya Kantor 2016-11-14 16:31:21 +03:00
parent 3defacc09d
commit f99574f53b
178 changed files with 530 additions and 271 deletions

View file

@ -1,27 +0,0 @@
```js run
function FormatError(message) {
this.name = "FormatError";
this.message = message;
if (Error.captureStackTrace) {
Error.captureStackTrace(this, this.constructor);
} else {
this.stack = (new Error()).stack;
}
}
FormatError.prototype = Object.create(SyntaxError.prototype);
FormatError.prototype.constructor = FormatError;
// Использование
var err = new FormatError("ошибка форматирования");
alert( err.message ); // ошибка форматирования
alert( err.name ); // FormatError
alert( err.stack ); // стек на момент генерации ошибки
alert( err instanceof SyntaxError ); // true
```