Files
tg-bot-template/packages/services/src/payment/errors.ts
Yuu Ottosoka f9ecac94f2 feat: add file storage service and update configurations
refactor: migrate to tsup for builds and update tsconfigs
fix: update error handling and validation in payment service
chore: update package scripts and dependencies
docs: update README and env examples
2025-07-12 16:01:57 +03:00

21 lines
684 B
TypeScript

import { AppError, createAppError } from "@repo/exceptions";
export enum PaymentErrorCode {
PAYMENT_NOT_FOUND = "PAYMENT_NOT_FOUND",
PAYMENT_ALREADY_PROCESSED = "PAYMENT_ALREADY_PROCESSED",
}
export type PaymentError = AppError<PaymentErrorCode>;
export const paymentNotFound = (paymentId: string): PaymentError =>
createAppError<PaymentErrorCode>(
PaymentErrorCode.PAYMENT_NOT_FOUND,
`Payment with id ${paymentId} not found`,
) as PaymentError;
export const paymentAlreadyProcessed = (paymentId: string): PaymentError =>
createAppError(
PaymentErrorCode.PAYMENT_ALREADY_PROCESSED,
`Payment ${paymentId} has already been processed`,
) as PaymentError;