ErrorMapper
in package
Central status→error mapper (CONTRACT.md §2, D-10). {@see self::fromStatus()} is the single translation point from an HTTP status code to a typed {@see AxiamException} subtype — no other class in the SDK is permitted to hand-roll this branching: 401 → {@see AuthError}; 403/409 → {@see AuthzError}; everything else (400/408/429/5xx/transport) → {@see NetworkError}.
Table of Contents
Methods
- fromResponse() : AxiamException
- Convenience wrapper for callers that already hold a live PSR-7 response — delegates to {@see self::fromStatus()}, the single translation point.
- fromStatus() : AxiamException
- The single translation point. When a live PSR-7 `$response` is available, pass it so a resulting {@see NetworkError} can build its redacted header summary via {@see NetworkError::fromResponse()}; otherwise a status-only {@see NetworkError} is built via {@see NetworkError::fromException()}.
Methods
fromResponse()
Convenience wrapper for callers that already hold a live PSR-7 response — delegates to {@see self::fromStatus()}, the single translation point.
public
static fromResponse(ResponseInterface $response[, string $context = 'AXIAM API error' ]) : AxiamException
Parameters
- $response : ResponseInterface
- $context : string = 'AXIAM API error'
Return values
AxiamExceptionfromStatus()
The single translation point. When a live PSR-7 `$response` is available, pass it so a resulting {@see NetworkError} can build its redacted header summary via {@see NetworkError::fromResponse()}; otherwise a status-only {@see NetworkError} is built via {@see NetworkError::fromException()}.
public
static fromStatus(int $status[, ResponseInterface|null $response = null ][, string $context = 'AXIAM API error' ]) : AxiamException
Parameters
- $status : int
- $response : ResponseInterface|null = null
- $context : string = 'AXIAM API error'