backend/src/errors/RunnerErrors.ts
2021-01-10 16:07:37 +01:00

36 lines
981 B
TypeScript

import { IsString } from 'class-validator';
import { NotAcceptableError, NotFoundError } from 'routing-controllers';
/**
* Error to throw when a runner couldn't be found.
*/
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.
*/
export class RunnerIdsNotMatchingError extends NotAcceptableError {
@IsString()
name = "RunnerIdsNotMatchingError"
@IsString()
message = "The ids 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 organisation)! \n You provided neither."
}