From a9a5eb673570bb3c0d1a55bb1292e208493663bd Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Tue, 19 Jan 2021 16:06:42 +0100 Subject: [PATCH] Updated the contact errors ref #104 --- src/errors/GroupContactErrors.ts | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/errors/GroupContactErrors.ts b/src/errors/GroupContactErrors.ts index 92fd4a2..fffbdd5 100644 --- a/src/errors/GroupContactErrors.ts +++ b/src/errors/GroupContactErrors.ts @@ -2,18 +2,7 @@ import { IsString } from 'class-validator'; import { NotAcceptableError, NotFoundError } from 'routing-controllers'; /** - * Error to throw, when a provided groupContact doesn't belong to the accepted types. - */ -export class GroupContactWrongTypeError extends NotAcceptableError { - @IsString() - name = "GroupContactWrongTypeError" - - @IsString() - message = "The groupContact must be an existing groupContact's id. \n You provided a object of another type." -} - -/** - * Error to throw, when a non-existent groupContact get's loaded. + * Error to throw, when a non-existent contact get's requested. */ export class GroupContactNotFoundError extends NotFoundError { @IsString() @@ -21,4 +10,16 @@ export class GroupContactNotFoundError extends NotFoundError { @IsString() message = "The groupContact you provided couldn't be located in the system. \n Please check your request." -} \ No newline at end of file +} + +/** + * Error to throw when two contacts' ids don't match. + * Usually occurs when a user tries to change a contact's id. + */ +export class GroupContactIdsNotMatchingError extends NotAcceptableError { + @IsString() + name = "GroupContactIdsNotMatchingError" + + @IsString() + message = "The ids don't match! \n And if you wanted to change a contact's id: This isn't allowed!" +}