Skip to content

Latest commit

 

History

History
16 lines (13 loc) · 353 Bytes

File metadata and controls

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

let err = new FormatError("error de formato");

alert( err.message ); // error de formato
alert( err.name ); // FormatError
alert( err.stack ); // pila

alert( err instanceof SyntaxError ); // true