From 980ac646889690ae773de75b984dc9eec4e67bb1 Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Wed, 2 Dec 2020 18:50:49 +0100 Subject: [PATCH] Added basic runner related errors --- src/errors/RunnerErrors.ts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/errors/RunnerErrors.ts diff --git a/src/errors/RunnerErrors.ts b/src/errors/RunnerErrors.ts new file mode 100644 index 0000000..c725c03 --- /dev/null +++ b/src/errors/RunnerErrors.ts @@ -0,0 +1,27 @@ +import { JsonController, Param, Body, Get, Post, Put, Delete, NotFoundError, OnUndefined, NotAcceptableError } from 'routing-controllers'; +import { IsInt, IsNotEmpty, IsPositive, IsString } from 'class-validator'; + +/** + * Error to throw when a runner couldn't be found. + * Implemented this ways to work with the json-schema conversion for openapi. + */ +export class RunnerNotFoundError extends NotFoundError { + @IsString() + name = "RunnerNotFoundError" + + @IsString() + message = "Runner not found!" +} + +/** + * Error to throw when two runners' ids don't match. + * Usually occurs when a user tries to change a runner's id. + * Implemented this ways to work with the json-schema conversion for openapi. + */ +export class RunnerIdsNotMatchingError extends NotAcceptableError { + @IsString() + name = "RunnerIdsNotMatchingError" + + @IsString() + message = "The id's don't match!! \n And if you wanted to change a runner's id: This isn't allowed" +} \ No newline at end of file