Files
goodgo-platform/apps
Ho Ngoc Hai 9e70074403 refactor(api): migrate all raw Error throws to DomainException (GOO-53)
Replace 14 raw `throw new Error(...)` instances in shared/, analytics/,
payments/ and listings/ with typed DomainException subclasses:

- env-validation.ts: INTERNAL_ERROR (3 startup config guards)
- field-encryption.ts: INTERNAL_ERROR / VALIDATION_FAILED (2 instances)
- result.ts: INTERNAL_ERROR (unwrapErr misuse guard)
- ai-service.client.ts: AI_PROVIDER_ERROR (HTTP error from AI service)
- prisma-avm.service.ts: VALIDATION_FAILED + NotFoundException (2 instances)
- avm-retrain-cron.service.ts: AI_PROVIDER_ERROR (2 upload/retrain failures)
- zalopay.service.ts: PAYMENT_FAILED (gateway failure)
- momo.service.ts: PAYMENT_FAILED (gateway failure)
- media-storage.service.ts: INTERNAL_ERROR (missing env var)

Update prisma-avm spec to match new NotFoundException message format.
All 6 PrismaAVMService tests and 31 shared domain tests pass.
Pre-existing failures in admin/industrial/mcp modules are unrelated.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-23 20:12:48 +07:00
..