forge-dashboard-sdk-php

ApiError extends RuntimeException
in package

FinalYes

Thrown for any forge-dashboard response carrying an error body -- every 4xx/5xx in the spec shares the same {error} shape (rules/sdk-generation.md's "Client shape": map errors to typed exceptions carrying the HTTP status and the parsed error body, never a bare string or the raw response).

Table of Contents

Properties

$statusCode  : int

Methods

__construct()  : mixed
fromGeneratedException()  : self
Builds an ApiError from the ApiException the generated Api classes throw on any non-2xx response. Prefers the deserialized Error model openapi-generator attaches for status codes the spec documents explicitly; falls back to decoding the raw JSON body itself for a status code the spec doesn't list (a 429 or 500, say), since the generated code never deserializes those.
decodeMessage()  : string

Properties

$statusCode read-only

public int $statusCode

Methods

__construct()

public __construct(int $statusCode, string $apiMessage[, Throwable|null $previous = null ]) : mixed
Parameters
$statusCode : int
$apiMessage : string
$previous : Throwable|null = null

fromGeneratedException()

Builds an ApiError from the ApiException the generated Api classes throw on any non-2xx response. Prefers the deserialized Error model openapi-generator attaches for status codes the spec documents explicitly; falls back to decoding the raw JSON body itself for a status code the spec doesn't list (a 429 or 500, say), since the generated code never deserializes those.

public static fromGeneratedException(ApiException $exception) : self
Parameters
$exception : ApiException
Return values
self
On this page

Search results