Skip to content

Latest commit

 

History

History
16 lines (13 loc) · 354 Bytes

File metadata and controls

16 lines (13 loc) · 354 Bytes
class FormatError extends SyntaxError {
  constructor(message) {
    super(message);
    this.name = this.constructor.name;
  }
}

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

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

alert( err instanceof SyntaxError ); // true