38 lines
681 B
TypeScript
Raw Normal View History

2017-12-16 17:54:53 +01:00
export class Error {
name: string = "Error";
2017-12-16 17:54:53 +01:00
stack: string = ""; // TODO
constructor(
public message: string = ""
) {}
2018-11-12 09:11:45 +01:00
toString(): string {
var message = this.message;
return message.length
? this.name + ": " + message
: this.name;
}
2017-12-16 17:54:53 +01:00
}
2018-11-12 09:11:45 +01:00
export class RangeError extends Error {
constructor(message: string = "") {
super(message);
this.name = "RangeError";
}
}
export class TypeError extends Error {
constructor(message: string = "") {
super(message);
this.name = "TypeError";
}
}
export class SyntaxError extends Error {
constructor(message: string = "") {
super(message);
this.name = "SyntaxError";
}
}