Files
mercadodevida/project/src/modules/cart/domain/errors.ts
2026-08-20 06:16:38 +02:00

20 lines
543 B
TypeScript

export class InvalidCartQuantityError extends Error {
constructor() {
super('Cart quantity must be a positive integer');
this.name = 'InvalidCartQuantityError';
}
}
export class InsufficientCartStockError extends Error {
constructor(
public readonly variantId: string,
public readonly requested: number,
public readonly available: number,
) {
super(
`Insufficient stock for variant ${variantId}: requested ${requested}, available ${available}`,
);
this.name = 'InsufficientCartStockError';
}
}