UNPKG

errors.ts

Version:
44 lines (43 loc) 1.02 kB
/** * @Copyright Mohtasim Alam Sohom * @Author Sohom829 * MIT Licensed */ // Classes // NonStringError class NonStringError extends TypeError { constructor(message) { super(message); this.name = this.constructor.name; } } // NonBooleanError class NonBooleanError extends TypeError { constructor(message) { super(message); this.name = this.constructor.name; } } // NonNumberError class NonNumberError extends TypeError { constructor(message) { super(message); this.name = this.constructor.name; } } // CreateCustomError class CustomError extends Error { constructor(name, statusCode, description) { super(description); Object.setPrototypeOf(this, new.target.prototype); this.name = name; this.ErrStatus = statusCode; this.ErrMessage = description; } } module.exports = { CustomError, NonStringError, NonNumberError, NonBooleanError };