user-managements-node-server
Version:
starter for express node server with user managements, authentication authorization
14 lines (11 loc) • 421 B
JavaScript
import httpStatus from 'http-status'
class HttpError extends Error {
constructor(httpStatusCode = httpStatus.INTERNAL_SERVER_ERROR, code){
super( code || httpStatus[httpStatusCode] )
this.httpStatusCode = httpStatusCode
this.code = code
typeof Error.captureStackTrace === 'function'
&& Error.captureStackTrace(this, this.constructor)
}
}
export default HttpError