From 983fa41cba3a4d537ab742a149b86d6c6a87f5bf Mon Sep 17 00:00:00 2001 From: Philipp Dormann Date: Thu, 3 Dec 2020 18:33:30 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20CreateUserErrors=20model?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref #14 --- src/errors/CreateUserErrors.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/errors/CreateUserErrors.ts diff --git a/src/errors/CreateUserErrors.ts b/src/errors/CreateUserErrors.ts new file mode 100644 index 0000000..3b28735 --- /dev/null +++ b/src/errors/CreateUserErrors.ts @@ -0,0 +1,24 @@ +import { NotFoundError } from 'routing-controllers'; +import { IsString } from 'class-validator'; + +/** + * Error to throw when a usergroup couldn't be found. + */ +export class UserGroupNotFoundError extends NotFoundError { + @IsString() + name = "UserGroupNotFoundError" + + @IsString() + message = "User Group not found!" +} + +/** + * Error to throw when no username or email is set + */ +export class UsernameOrEmailNeededError extends NotFoundError { + @IsString() + name = "UsernameOrEmailNeededError" + + @IsString() + message = "no username or email is set!" +}