izartu API

Failure
in package

FinalYes

How a failed request is answered: 503 when the database is unreachable or a query fails on a database behind the code, both temporary, and 500 for anything else.

Table of Contents

Methods

answer()  : array{status: int, reason: "unavailable"|"upgrading"|"error"}
Log a failure and decide how to answer it.

Methods

answer()

Log a failure and decide how to answer it.

public static answer(Throwable $failure, callable(): bool $behind, callable(string): mixed $log) : array{status: int, reason: "unavailable"|"upgrading"|"error"}
Parameters
$failure : Throwable

What went wrong.

$behind : callable(): bool

Whether the database lacks migrations; asked only when a query failed.

$log : callable(string): mixed

Writes a message to the log.

Return values
array{status: int, reason: "unavailable"|"upgrading"|"error"} —

The HTTP status, and why.

On this page

Search results