CoolCMS API

BridgeFailureTrait

Boundary of the admin repository between `ApiBridge` and the UI.

An exception text (network, host, URL, database) and the free message of a technical failure in a bridge response must not enter the Result, because flash, row error and modal show it to the administrator. The detail goes to the server log only and the Result carries an empty message; on an empty message the caller shows a generic translated fallback. Messages of domain codes pass through unchanged.

Table of Contents

Methods

bridgeException()  : Result
Turns a caught bridge exception into `API_ERROR` without the exception text; the detail goes to the `admin.bridge` log channel.
bridgeMessage()  : string|null
Returns the message of a flat bridge response: null for a failure with a technical code (detail goes to the log), otherwise unchanged.

Methods

bridgeException()

Turns a caught bridge exception into `API_ERROR` without the exception text; the detail goes to the `admin.bridge` log channel.

protected bridgeException(Throwable $e, string $endpoint) : Result
Parameters
$e : Throwable
$endpoint : string
Return values
Result

bridgeMessage()

Returns the message of a flat bridge response: null for a failure with a technical code (detail goes to the log), otherwise unchanged.

protected bridgeMessage(array<string, mixed> $response, ResultCode $code, string $endpoint) : string|null
Parameters
$response : array<string, mixed>
$code : ResultCode
$endpoint : string
Return values
string|null
On this page

Search results