UNPKG

@mondaycom/apps-cli

Version:

A cli tool to manage apps (and monday-code projects) in monday.com

32 lines (31 loc) 1.06 kB
import { StatusCodes } from 'http-status-codes'; export class HttpError extends Error { code; description; title; constructor(message, title, code) { super(message); this.code = code; switch (code) { case StatusCodes.BAD_REQUEST: { this.description = 'The request could not be understood by the server due to malformed syntax or missing request header.'; break; } case StatusCodes.UNAUTHORIZED: { this.description = 'The request has not been applied because it lacks valid authentication credentials for the target resource.'; break; } case StatusCodes.INTERNAL_SERVER_ERROR: { this.description = 'An unexpected error occurred on the server.'; break; } default: { this.description = 'An error.'; } } this.title = title; this.message = message; } }