backend/src/errors/RunnerTeamErrors.ts

47 lines
1.3 KiB
TypeScript

import { IsString } from 'class-validator';
import { NotAcceptableError, NotFoundError } from 'routing-controllers';
/**
* Error to throw when a runner team couldn't be found.
*/
export class RunnerTeamNotFoundError extends NotFoundError {
@IsString()
name = "RunnerTeamNotFoundError"
@IsString()
message = "RunnerTeam not found!"
}
/**
* Error to throw when two runner teams' ids don't match.
* Usually occurs when a user tries to change a runner team's id.
*/
export class RunnerTeamIdsNotMatchingError extends NotAcceptableError {
@IsString()
name = "RunnerTeamIdsNotMatchingError"
@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 team still has runners associated.
*/
export class RunnerTeamHasRunnersError extends NotAcceptableError {
@IsString()
name = "RunnerTeamHasRunnersError"
@IsString()
message = "This team still has runners associated with it. \n If you want to delete this team with all it's runners and teams add `?force` to your query."
}
/**
* Error to throw when a team still has runners associated.
*/
export class RunnerTeamNeedsParentError extends NotAcceptableError {
@IsString()
name = "RunnerTeamNeedsParentError"
@IsString()
message = "You provided no runner organization as this team's parent group."
}