ErrorMapper
class
Vendidit\AuthServer\Http\ErrorMapperSource:src/Http/ErrorMapper.php
Map (HTTP status, error envelope) → typed exception subclass.
The auth-server envelope (pkg/shared/errors.WriteAPIError): { “code”: “TOKEN_EXPIRED”, “message”: ”…”, “details”: {…}, “request_id”: ”…” }
Some endpoints (legacy) use { “error”: { “code”, “message” } } — we defensively parse both shapes.
Methods
fromResponse(int $status, ?array $body, array $headers = [])
Build the appropriate exception. Caller is responsible for throwing.
@param array<string,mixed>|null $body decoded JSON body (or null on parse failure)
@param array<string,list