From d7c58b9de56c9aa03c3b5e962c94125a9d458432 Mon Sep 17 00:00:00 2001 From: Philip Molares Date: Sun, 25 Sep 2022 02:02:26 +0200 Subject: [PATCH] feat: add PasswordTooWeak error Signed-off-by: Philip Molares --- src/errors/error-mapping.ts | 4 ++++ src/errors/errors.ts | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/errors/error-mapping.ts b/src/errors/error-mapping.ts index c1f01e5d0..bb512db26 100644 --- a/src/errors/error-mapping.ts +++ b/src/errors/error-mapping.ts @@ -66,6 +66,10 @@ const mapOfHedgeDocErrorsToHttpErrors: Map = 'NoLocalIdentityError', (object): HttpException => new BadRequestException(object), ], + [ + 'PasswordTooWeakError', + (object): HttpException => new BadRequestException(object), + ], ]); @Catch() diff --git a/src/errors/errors.ts b/src/errors/errors.ts index 9ee14b990..b4aaaddb8 100644 --- a/src/errors/errors.ts +++ b/src/errors/errors.ts @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file) + * SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file) * * SPDX-License-Identifier: AGPL-3.0-only */ @@ -51,3 +51,7 @@ export class InvalidCredentialsError extends Error { export class NoLocalIdentityError extends Error { name = 'NoLocalIdentityError'; } + +export class PasswordTooWeakError extends Error { + name = 'PasswordTooWeakError'; +}