CoolCMS API

StoreFailure
in package

FinalYes

Converts a caught Store operation exception into a bridge response.

  • A Store domain exception (Models/Exceptions/) carries a message meant for the operator (for example insufficient stock), so a stable error code and the message are returned unchanged.
  • Any other Throwable (DBAL, ORM, TypeError) gets a stable generic code, a generic message and a short correlation ref that is also logged. The exception text and the PHP class name never leave the server.

The exception is always logged (channel store).

Table of Contents

Constants

GENERIC_ERROR  : string = 'storeOperationFailed'

Methods

fromThrowable()  : array{error: string, message: string, ref?: string}

Constants

GENERIC_ERROR

public string GENERIC_ERROR = 'storeOperationFailed'

Methods

fromThrowable()

public static fromThrowable(Throwable $e) : array{error: string, message: string, ref?: string}
Parameters
$e : Throwable
Return values
array{error: string, message: string, ref?: string}
On this page

Search results