Merge branch 'dev' into feature/93-user_endpoints
All checks were successful
continuous-integration/drone/pr Build is passing
All checks were successful
continuous-integration/drone/pr Build is passing
This commit is contained in:
25
src/errors/DonationErrors.ts
Normal file
25
src/errors/DonationErrors.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { IsString } from 'class-validator';
|
||||
import { NotAcceptableError, NotFoundError } from 'routing-controllers';
|
||||
|
||||
/**
|
||||
* Error to throw when a Donation couldn't be found.
|
||||
*/
|
||||
export class DonationNotFoundError extends NotFoundError {
|
||||
@IsString()
|
||||
name = "DonationNotFoundError"
|
||||
|
||||
@IsString()
|
||||
message = "Donation not found!"
|
||||
}
|
||||
|
||||
/**
|
||||
* Error to throw when two Donations' ids don't match.
|
||||
* Usually occurs when a user tries to change a Donation's id.
|
||||
*/
|
||||
export class DonationIdsNotMatchingError extends NotAcceptableError {
|
||||
@IsString()
|
||||
name = "DonationIdsNotMatchingError"
|
||||
|
||||
@IsString()
|
||||
message = "The ids don't match! \n And if you wanted to change a Donation's id: This isn't allowed!"
|
||||
}
|
||||
@@ -33,4 +33,15 @@ export class DonorReceiptAddressNeededError extends NotAcceptableError {
|
||||
|
||||
@IsString()
|
||||
message = "An address is needed to create a receipt for a donor. \n You didn't provide one."
|
||||
}
|
||||
|
||||
/**
|
||||
* Error to throw when a donor still has donations associated.
|
||||
*/
|
||||
export class DonorHasDonationsError extends NotAcceptableError {
|
||||
@IsString()
|
||||
name = "DonorHasDonationsError"
|
||||
|
||||
@IsString()
|
||||
message = "This donor still has donations associated with it. \n If you want to delete this donor with all it's donations and teams add `?force` to your query."
|
||||
}
|
||||
@@ -33,4 +33,15 @@ export class RunnerGroupNeededError extends NotAcceptableError {
|
||||
|
||||
@IsString()
|
||||
message = "Runner's need to be part of one group (team or organisation)! \n You provided neither."
|
||||
}
|
||||
|
||||
/**
|
||||
* Error to throw when a runner still has distance donations associated.
|
||||
*/
|
||||
export class RunnerHasDistanceDonationsError extends NotAcceptableError {
|
||||
@IsString()
|
||||
name = "RunnerHasDistanceDonationsError"
|
||||
|
||||
@IsString()
|
||||
message = "This runner still has distance donations associated with it. \n If you want to delete this runner with all it's donations and teams add `?force` to your query."
|
||||
}
|
||||
Reference in New Issue
Block a user