59 lines
1.9 KiB
TypeScript
59 lines
1.9 KiB
TypeScript
import { IsString } from 'class-validator';
|
|
import { NotAcceptableError, NotFoundError } from 'routing-controllers';
|
|
|
|
/**
|
|
* Error to throw when a runner organisation couldn't be found.
|
|
*/
|
|
export class RunnerOrganisationNotFoundError extends NotFoundError {
|
|
@IsString()
|
|
name = "RunnerOrganisationNotFoundError"
|
|
|
|
@IsString()
|
|
message = "RunnerOrganisation not found!"
|
|
}
|
|
|
|
/**
|
|
* Error to throw when two runner organisations' ids don't match.
|
|
* Usually occurs when a user tries to change a runner organisation's id.
|
|
*/
|
|
export class RunnerOrganisationIdsNotMatchingError extends NotAcceptableError {
|
|
@IsString()
|
|
name = "RunnerOrganisationIdsNotMatchingError"
|
|
|
|
@IsString()
|
|
message = "The ids don't match! \n And if you wanted to change a runner organisation's id: This isn't allowed!"
|
|
}
|
|
|
|
/**
|
|
* Error to throw when a organisation still has runners associated.
|
|
*/
|
|
export class RunnerOrganisationHasRunnersError extends NotAcceptableError {
|
|
@IsString()
|
|
name = "RunnerOrganisationHasRunnersError"
|
|
|
|
@IsString()
|
|
message = "This organisation still has runners associated with it. \n If you want to delete this organisation with all it's runners and teams add `?force` to your query."
|
|
}
|
|
|
|
/**
|
|
* Error to throw when a organisation still has teams associated.
|
|
*/
|
|
export class RunnerOrganisationHasTeamsError extends NotAcceptableError {
|
|
@IsString()
|
|
name = "RunnerOrganisationHasTeamsError"
|
|
|
|
@IsString()
|
|
message = "This organisation still has teams associated with it. \n If you want to delete this organisation with all it's runners and teams add `?force` to your query."
|
|
}
|
|
|
|
/**
|
|
* Error to throw, when a provided runnerOrganisation doesn't belong to the accepted types.
|
|
*/
|
|
export class RunnerOrganisationWrongTypeError extends NotAcceptableError {
|
|
@IsString()
|
|
name = "RunnerOrganisationWrongTypeError"
|
|
|
|
@IsString()
|
|
message = "The runner organisation must be an existing organisation's id. \n You provided a object of another type."
|
|
}
|