backend/src/errors/RunnerErrors.ts
2020-12-05 19:01:48 +01:00

38 lines
1.1 KiB
TypeScript

import { IsString } from 'class-validator';
import { NotAcceptableError, NotFoundError } from 'routing-controllers';
/**
* 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"
}
/**
* Error to throw when a runner is missing his group association.
*/
export class RunnerGroupNeededError extends NotAcceptableError {
@IsString()
name = "RunnerGroupNeededError"
@IsString()
message = "Runner's need to be part of one group (team or organisiation)! \n You provided neither."
}