Oihana PHP Arango

ConflictException extends ArangoException

Thrown when ArangoDB reports a write-write conflict on the same document.

The conflict typically surfaces as HTTP 409 with the internal Arango code ErrorCode::ARANGO_CONFLICT (1200). Retrying the operation after a short backoff is the canonical recovery path.

Tags
see
https://docs.arangodb.com/stable/develop/error-codes-and-meanings/
author

Marc Alcaraz (ekameleon)

since
1.0.0

Table of Contents

Properties

$errorNum  : int|null

Methods

__construct()  : mixed
Creates a new ConflictException instance.
fromResponse()  : ArangoException
Builds the appropriate {@see ArangoException} subclass from a parsed ArangoDB error response.
isSafeToRetry()  : bool
Conflict errors are transient: the caller should retry after a short backoff.

Properties

Methods

__construct()

Creates a new ConflictException instance.

public __construct([string $message = 'Write-write conflict on document' ][, int $httpStatus = 409 ][, Throwable|null $previous = null ]) : mixed
Parameters
$message : string = 'Write-write conflict on document'

Server-provided message describing the conflict.

$httpStatus : int = 409

HTTP status returned by the server (defaults to 409).

$previous : Throwable|null = null

Previous exception in the chain.

fromResponse()

Builds the appropriate {@see ArangoException} subclass from a parsed ArangoDB error response.

public static fromResponse(int $httpStatus[, array<string|int, mixed> $body = [] ][, Throwable|null $previous = null ]) : ArangoException

The factory inspects the errorNum field of the response body and dispatches to a dedicated subclass when the code is known. The HTTP status is preserved on the resulting exception (exposed via getCode()).

Expected body shape (server-provided):

{ "error": true, "code": 404, "errorNum": 1202, "errorMessage": "document not found" }
Parameters
$httpStatus : int

HTTP status returned by the server.

$body : array<string|int, mixed> = []

Decoded JSON body (may be empty when the server returned no body).

$previous : Throwable|null = null

Previous exception in the chain (typically the Guzzle exception).

Return values
ArangoException

isSafeToRetry()

Conflict errors are transient: the caller should retry after a short backoff.

public isSafeToRetry() : bool
Return values
bool

Always true.

On this page

Search results