ApiError
in package
FinalYes
Turn RB Premium API error HTTP responses / deserialized error models into ApiException instances whose message includes both `error` and `error_description` (e.g. UNAUTHORISED / Certificate is terminated).
Table of Contents
Constants
- MODEL_STATUS : array<class-string, int> = [\VitexSoftware\Raiffeisenbank\Model\GetBalance...
- HTTP status associated with generated error-model classes.
Methods
- assertSuccess() : void
- Throw unless $result is an instance of the expected success class.
- formatMessage() : string
- Human-readable one-line error for logs and JSON reports.
- fromHttpResponse() : ApiException
- Build an ApiException from a raw HTTP error response.
- fromResponseModel() : ApiException
- Build an ApiException from a deserialized OpenAPI error model.
- decodeBody() : null|array<string, mixed>|stdClass
- extractDescription() : string|null
- extractError() : string|null
Constants
MODEL_STATUS
HTTP status associated with generated error-model classes.
private
array<class-string, int>
MODEL_STATUS
= [\VitexSoftware\Raiffeisenbank\Model\GetBalance401Response::class => 401, \VitexSoftware\Raiffeisenbank\Model\GetBalance403Response::class => 403, \VitexSoftware\Raiffeisenbank\Model\GetBalance404Response::class => 404, \VitexSoftware\Raiffeisenbank\Model\GetBalance429Response::class => 429, \VitexSoftware\Raiffeisenbank\Model\GetStatements400Response::class => 400, \VitexSoftware\Raiffeisenbank\Model\GetTransactionList400Response::class => 400]
Methods
assertSuccess()
Throw unless $result is an instance of the expected success class.
public
static assertSuccess(object $result, class-string $successClass) : void
Parameters
- $result : object
- $successClass : class-string
Tags
formatMessage()
Human-readable one-line error for logs and JSON reports.
public
static formatMessage(int $statusCode, string|null $error, string|null $description[, string $fallbackBody = '' ]) : string
Parameters
- $statusCode : int
- $error : string|null
- $description : string|null
- $fallbackBody : string = ''
Return values
stringfromHttpResponse()
Build an ApiException from a raw HTTP error response.
public
static fromHttpResponse(ResponseInterface $response) : ApiException
Parameters
- $response : ResponseInterface
Return values
ApiExceptionfromResponseModel()
Build an ApiException from a deserialized OpenAPI error model.
public
static fromResponseModel(object $result[, int $statusCode = 0 ]) : ApiException
Parameters
- $result : object
- $statusCode : int = 0
Return values
ApiExceptiondecodeBody()
private
static decodeBody(string $body) : null|array<string, mixed>|stdClass
Parameters
- $body : string
Return values
null|array<string, mixed>|stdClassextractDescription()
private
static extractDescription(mixed $decoded) : string|null
Parameters
- $decoded : mixed
Return values
string|nullextractError()
private
static extractError(mixed $decoded) : string|null
Parameters
- $decoded : mixed