You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

20 lines
623 B

// Surprisingly involved error subclassing
// See https://stackoverflow.com/questions/41102060/typescript-extending-error-class
export class EnvError extends TypeError {
constructor(message?: string) {
super(message)
Object.setPrototypeOf(this, new.target.prototype)
Error.captureStackTrace(this, EnvError)
this.name = this.constructor.name
}
}
export class EnvMissingError extends ReferenceError {
constructor(message?: string) {
super(message)
Object.setPrototypeOf(this, new.target.prototype)
Error.captureStackTrace(this, EnvMissingError)
this.name = this.constructor.name
}
}