/** * Copyright © 2024 Nevis Security AG. All rights reserved. */ import { PasswordEnrollmentCustomValidationError } from './PasswordEnrollmentCustomValidationError'; import { PasswordEnrollmentError } from './PasswordEnrollmentError'; import { ErrorConverter } from '../../ErrorConverter'; enum PasswordEnrollmentErrorType { CustomValidationError, } export class PasswordEnrollmentErrorConverter extends ErrorConverter { convert(): PasswordEnrollmentError { const subtype = PasswordEnrollmentErrorType[ this.error.type as keyof typeof PasswordEnrollmentErrorType ]; switch (subtype) { case PasswordEnrollmentErrorType.CustomValidationError: return new PasswordEnrollmentCustomValidationError( this.error.description, this.error.cause ); } } }