AppException - viames/pair GitHub Wiki
Pair framework: AppException
Pair\Exceptions\AppException is intended for front-end web application errors.
It extends PairException and triggers user-facing notifications.
Constructor behavior
__construct(string $message, int $code = 0, ?Throwable $previous = null):
- for
CSRF_TOKEN_INVALID, shows a modal prompting page reload - otherwise triggers generic front-end error notification via
PairException::frontEnd() - logs via parent exception behavior
Implementation example
use Pair\Exceptions\AppException;
use Pair\Exceptions\ErrorCodes;
if (!$isValidCsrf) {
throw new AppException('Invalid CSRF token', ErrorCodes::CSRF_TOKEN_INVALID);
}
See also: PairException, CriticalException, ErrorCodes.