-
Notifications
You must be signed in to change notification settings - Fork 2
ErrorCodes
Viames Marino edited this page Apr 25, 2026
·
3 revisions
Pair\Exceptions\ErrorCodes contains framework error code constants used across exceptions and logs.
Use constants when throwing Pair exceptions so logs and handling rules are consistent.
use Pair\Exceptions\ErrorCodes;
use Pair\Exceptions\PairException;
throw new PairException('DB query failed', ErrorCodes::DB_QUERY_FAILED);Some codes are treated as critical and can escalate to CriticalException.
This keeps error-handling behavior deterministic across framework layers.
- choose the most specific code available
- avoid magic numbers in throws/replies
- keep application-specific codes separate from framework-level constants
Integration-specific constants include errors such as STRIPE_ERROR, GOOGLE_MAPS_ERROR, WHATSAPP_ERROR, OPENAI_ERROR, GEMINI_ERROR, CLAUDE_ERROR, RESEND_ERROR, CLOUDFLARE_TURNSTILE_ERROR, MEILISEARCH_ERROR, SENTRY_ERROR, OPENTELEMETRY_ERROR, and SUPABASE_ERROR.
See also: PairException, CriticalException, AppException, ApiException.