From d803704eeebc5d5a188cb9fd5c9afd6882579fd3 Mon Sep 17 00:00:00 2001 From: Philipp Dormann Date: Fri, 4 Dec 2020 23:02:23 +0100 Subject: [PATCH] UserNotFoundError ref #12 --- src/errors/AuthError.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/errors/AuthError.ts b/src/errors/AuthError.ts index 24ded8a..a0de93a 100644 --- a/src/errors/AuthError.ts +++ b/src/errors/AuthError.ts @@ -1,5 +1,5 @@ import { IsString } from 'class-validator'; -import { ForbiddenError, NotAcceptableError, UnauthorizedError } from 'routing-controllers'; +import { ForbiddenError, NotAcceptableError, NotFoundError, UnauthorizedError } from 'routing-controllers'; /** * Error to throw when a jwt is expired @@ -65,4 +65,15 @@ export class PasswordNeededError extends NotAcceptableError { @IsString() message = "no password is provided - you need to provide it" +} + +/** + * Error to thow when no user could be found for provided credential + */ +export class UserNotFoundError extends NotFoundError { + @IsString() + name = "UserNotFoundError" + + @IsString() + message = "no user could be found for provided credential" } \ No newline at end of file