UNPKG

@hoangnam.io/qa-tools

Version:

Logging, Error handling, Notifying for Express codebase

19 lines (16 loc) 510 B
class BaseError extends Error { constructor(message, details, statusCode) { super(message); Object.setPrototypeOf(this, new.target.prototype); this.details = details; this.statusCode = statusCode; Error.captureStackTrace(this); } } class InputDataInvalidExample extends BaseError { constructor({ message = "Input data is invalid", details = {} }) { super(message, details, 400); this.name = "InputDataInvalid"; } } module.exports = { BaseError, InputDataInvalidExample };