20 lines
543 B
TypeScript
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';
|
|
}
|
|
}
|