learning_ai_common_plat/packages/errors
saravanakumardb1 3a5196417d fix(errors): make ServiceError instanceof cross-instance-safe
When docker-prep packs @bytelyst/* as tarballs, a second physical copy of
@bytelyst/errors can be created, breaking prototype identity. The
fastify-core error handler's 'error instanceof ServiceError' then returned
false, mis-mapping ConflictError/BadRequestError/etc. to HTTP 500.

Fix: brand ServiceError instances with a global Symbol.for() key and add a
Symbol.hasInstance that recognizes any branded instance for the base class,
while preserving prototype-chain semantics for subclasses. Resilient to
duplicated module copies without touching call sites.

- errors: brand + custom hasInstance (+3 cross-instance unit tests)
- fastify-core: regression test (duplicated-copy ServiceError -> 409 not 500)
- bump @bytelyst/errors 0.1.11 -> 0.1.13, published to Gitea registry
2026-05-28 22:02:35 -07:00
..
src fix(errors): make ServiceError instanceof cross-instance-safe 2026-05-28 22:02:35 -07:00
package.json fix(errors): make ServiceError instanceof cross-instance-safe 2026-05-28 22:02:35 -07:00
tsconfig.json feat(errors): add @bytelyst/errors package 2026-02-12 11:19:35 -08:00