-
Notifications
You must be signed in to change notification settings - Fork 2
ErrorCodes
Viames Marino edited this page Feb 23, 2026
·
1 revision
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
See also: PairException, CriticalException, AppException, ApiException.