export class InvalidParametersError extends Error { constructor(message: string) { super(message) this.name = 'InvalidParametersError' } } export class InvalidKeysError extends Error { constructor(message: string) { super(message) this.name = 'InvalidKeysError' } } export class MissingParametersError extends Error { constructor(message: string) { super(message) this.name = 'MissingParametersError' } } export class PermissionError extends Error { constructor(message: string) { super(message) this.name = 'PermissionError' } } export class ServerRefusesError extends Error { constructor(message: string, error?: any) { super(message) this.name = 'ServerRefusesError' this.handleStatusCodes(error) } private handleStatusCodes(error: any = {}) { if (error.response) { const statusCode = error.response.status switch (statusCode) { case 403: { // forbidden // error.response.data === 'You do not have permission to perform this action.' } } } } } export class WrongAccountTypeError extends Error { constructor(message: string) { super(message) this.name = 'WrongAccountTypeError' } }