import { BackendError , BackendErrorLabel , StatusCode , SyntheticErrorLabel } from '../http/' ; export class AuthenticationError extends BackendError { constructor ( message , label , code ) { super ( message , label , code ) ; Object . setPrototypeOf ( this , new . target . prototype ) ; this . name = 'AuthenticationError' ; } } export class LoginTooFrequentError extends AuthenticationError { constructor ( message , label = BackendErrorLabel . CLIENT_ERROR , code = StatusCode . TOO_MANY_REQUESTS ) { super ( message , label , code ) ; Object . setPrototypeOf ( this , new . target . prototype ) ; this . name = 'LoginTooFrequentError' ; } } export class InvalidCredentialsError extends AuthenticationError { constructor ( message , label = BackendErrorLabel . INVALID_CREDENTIALS , code = StatusCode . FORBIDDEN ) { super ( message , label , code ) ; Object . setPrototypeOf ( this , new . target . prototype ) ; this . name = 'InvalidCredentialsError' ; } } export class SuspendedAccountError extends AuthenticationError { constructor ( message , label = BackendErrorLabel . SUSPENDED_ACCOUNT , code = StatusCode . FORBIDDEN ) { super ( message , label , code ) ; Object . setPrototypeOf ( this , new . target . prototype ) ; this . name = 'SuspendedAccountError' ; } } export class IdentifierExistsError extends AuthenticationError { constructor ( message , label = BackendErrorLabel . KEY_EXISTS , code = StatusCode . CONFLICT ) { super ( message , label , code ) ; Object . setPrototypeOf ( this , new . target . prototype ) ; this . name = 'IdentifierExistsError' ; } } export class TokenExpiredError extends AuthenticationError { constructor ( message , label = BackendErrorLabel . INVALID_CREDENTIALS , code = StatusCode . FORBIDDEN ) { super ( message , label , code ) ; Object . setPrototypeOf ( this , new . target . prototype ) ; this . name = 'TokenExpiredError' ; } } export class InvalidTokenError extends AuthenticationError { constructor ( message , label = BackendErrorLabel . INVALID_CREDENTIALS , code = StatusCode . FORBIDDEN ) { super ( message , label , code ) ; Object . setPrototypeOf ( this , new . target . prototype ) ; this . name = 'InvalidTokenError' ; } } export class MissingCookieError extends AuthenticationError { constructor ( message , label = BackendErrorLabel . INVALID_CREDENTIALS , code = StatusCode . FORBIDDEN ) { super ( message , label , code ) ; Object . setPrototypeOf ( this , new . target . prototype ) ; this . name = 'MissingCookieError' ; } } export class InvalidPhoneNumberError extends AuthenticationError { constructor ( message , label = SyntheticErrorLabel . INVALID_PHONE_NUMBER , code = StatusCode . BAD_REQUEST ) { super ( message , label , code ) ; Object . setPrototypeOf ( this , new . target . prototype ) ; this . name = 'InvalidPhoneNumberError' ; } } export class ForbiddenPhoneNumberError extends AuthenticationError { constructor ( message , label = SyntheticErrorLabel . FORBIDDEN_PHONE_NUMBER , code = StatusCode . FORBIDDEN ) { super ( message , label , code ) ; Object . setPrototypeOf ( this , new . target . prototype ) ; this . name = 'ForbiddenPhoneNumberError' ; } } export class PasswordExistsError extends AuthenticationError { constructor ( message , label = BackendErrorLabel . PASSWORD_EXISTS , code = StatusCode . UNAUTHORIZED ) { super ( message , label , code ) ; Object . setPrototypeOf ( this , new . target . prototype ) ; this . name = 'PasswordExistsError' ; } }