NetworkError
extends AxiamException
in package
Transport-level failure: connection refused, timeout, TLS error, DNS failure, or a server-side 5xx (CONTRACT.md ยง2).
Redact-before-wrap (D-10/D-11, CR-04 carry-forward): self::fromResponse() is
the ONLY construction path that accepts a live PSR-7 ResponseInterface, and it
strips the Set-Cookie/Authorization/Cookie header VALUES into a sanitized
summary string BEFORE the constructor ever runs. There is no public constructor and
no path that stores the raw $response object (or any wrapped exception that might
itself carry one) as this exception's message, cause, or any other property โ this
structurally prevents the token-leak-via-error class of bug first found in the
TypeScript sibling SDK (Phase 17 CR-04, its src/core/errorMapper.ts
sanitizeAxiosError) and mirrored by every later sibling SDK's NetworkError.
Table of Contents
Methods
- fromException() : self
- Builds a NetworkError from a caught transport exception (socket/TLS/DNS/timeout failure). The caught exception's own message is defensively regex-sanitized in case a lower-level exception echoed a sensitive header verbatim; the exception itself is never stored as a cause (see class doc).
- fromResponse() : self
- Builds a NetworkError from a live PSR-7 response. Header NAMES are preserved for debuggability; VALUES of `Set-Cookie`/`Authorization`/`Cookie` are replaced with `[SENSITIVE]` before the summary string is built. The `$response` argument itself is never stored โ only the resulting sanitized string survives past this method.
Methods
fromException()
Builds a NetworkError from a caught transport exception (socket/TLS/DNS/timeout failure). The caught exception's own message is defensively regex-sanitized in case a lower-level exception echoed a sensitive header verbatim; the exception itself is never stored as a cause (see class doc).
public
static fromException(Throwable $exception[, string $context = 'Transport error' ]) : self
Parameters
- $exception : Throwable
- $context : string = 'Transport error'
Return values
selffromResponse()
Builds a NetworkError from a live PSR-7 response. Header NAMES are preserved for debuggability; VALUES of `Set-Cookie`/`Authorization`/`Cookie` are replaced with `[SENSITIVE]` before the summary string is built. The `$response` argument itself is never stored โ only the resulting sanitized string survives past this method.
public
static fromResponse(ResponseInterface $response[, string $context = 'HTTP error' ]) : self
Parameters
- $response : ResponseInterface
- $context : string = 'HTTP error'