diff --git a/src/errors/DonationErrors.ts b/src/errors/DonationErrors.ts new file mode 100644 index 0000000..2c69800 --- /dev/null +++ b/src/errors/DonationErrors.ts @@ -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!" +} \ No newline at end of file