-
Notifications
You must be signed in to change notification settings - Fork 2
ApiException
Viames Marino edited this page Feb 23, 2026
·
1 revision
Pair\Exceptions\ApiException is specialized for API request error handling.
__construct(string $message, int $code = 0, ?Throwable $previous = null):
- logs error message (prefers previous exception message when available)
- keeps API-oriented exception semantics from
PairExceptionhierarchy
- in production, replaces message with translated generic message
- sends JSON error response
use Pair\Exceptions\ApiException;
if (!$token) {
ApiException::reply('Missing token', 1001, 401);
}See also: AjaxException, PairException, API.