evrimfeyyaz/covid-19-api

View on GitHub
src/COVID19APIError.ts

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
/**
 * The super class of all the errors in this library.
 */
export class COVID19APIError extends Error {
  constructor(message: string) {
    super(message);
    this.name = "COVID19APIError";

    // This is needed because of:
    // https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
    Object.setPrototypeOf(this, COVID19APIError.prototype);
  }
}