← ClaudeAtlas

php-error-handlinglisted

Handle errors from the PayPal Server SDK PHP SDK. Load before your first try/catch around a call, or when building an error-translation layer. The class list won't tell you whether a non-2xx throws at all in this SDK, where the error payload actually lives, or that an inline `catch` inside a namespaced file never matches.
MuHamza30/paypal-api-plugin · ★ 0 · Data & Documents · score 70
Install: claude install-skill MuHamza30/paypal-api-plugin
# Error handling for an APIMatic PHP SDK ## First: where does a failure surface? Two independent facts about this SDK decide it, and **the first is already settled**: it returns the `ApiResponse` wrapper — either it was built to return complete responses, or it never raises on an error status, either of which produces the wrapper — so `src/Http/ApiResponse.php` is generated, every operation returns the wrapper, and **an error status never raises**. Each handler chain ends `->returnApiResponse()`, which makes the runtime return the wrapper on a failure instead of throwing. One question is left, and the filesystem answers it — settle it before you write any `try`: > **Does `src/Exceptions/ApiException.php` exist?** (an SDK that maps its error types into the response > omits it) > - **Yes** → there is something throwable, but only for a **transport** failure; a non-2xx still comes > back inside the wrapper. > - **No** → nothing is throwable at all. The classes under `src/Exceptions/` are plain error *models*, > and a `try/catch` around a call catches nothing — not even a network failure. That leaves two builds this SDK can be: | `ApiException.php` | A non-2xx status | A transport failure | | --- | --- | --- | | present — the **wrapper build** | returns the wrapper; `getResult()` is the **raw decoded body** | throws `ApiException` with a `getCode()` of `0` | | absent — the **mapped build** | returns the wrapper; `getResult()` is the **deserialized error model** for any s