Summary
The EAN encoder in src/encoders/ean.ts throws plain Error instead of InvalidInputError from the project's error classes, inconsistent with all other encoders.
Details
// ean.ts line 87
throw new Error("EAN-13 requires 12 or 13 digits");
// ean.ts line 150
throw new Error("EAN-8 requires 7 or 8 digits");
Every other encoder in the project uses:
import { InvalidInputError } from "../errors";
throw new InvalidInputError("...");
Impact
- Users catching
InvalidInputError will miss EAN validation errors
- Inconsistent error handling behavior across the library
Fix
Import InvalidInputError and replace both throw new Error(...) calls.
Summary
The EAN encoder in
src/encoders/ean.tsthrows plainErrorinstead ofInvalidInputErrorfrom the project's error classes, inconsistent with all other encoders.Details
Every other encoder in the project uses:
Impact
InvalidInputErrorwill miss EAN validation errorsFix
Import
InvalidInputErrorand replace boththrow new Error(...)calls.