RuntimeException

Class
extends RuntimeException
Final: Yes

Represents runtime failures raised while spawning, coordinating, or monitoring worker processes.

Description

This exception type is intended for operational failures that occur during process management, transport allocation, PID resolution, or wait handling. Callers MUST treat this exception as an execution-time failure rather than as an indication of invalid API usage. Library internals SHOULD use this exception when an operation is valid in principle but cannot be completed in the current runtime state.

Table of Contents

Interfaces

ForkExceptionInterface

Represents the base contract for all exceptions thrown by the fork library.

Methods

forUnableToForkWorker()

Creates an exception for failed worker fork attempts.

 : self
forUndetectableProcessIdentifier()

Creates an exception for failures while resolving the current PID.

 : self
forUnsupportedForking()

Creates an exception for runtimes that cannot support process forking.

 : self
forWorkerOutputAllocationFailure()

Creates an exception for failures while allocating worker output transport.

 : self
forWorkersWaitFailure()

Creates an exception for failures while waiting on multiple workers.

 : self
forWorkerWaitFailure()

Creates an exception for failures while waiting on a specific worker.

 : self
__construct()

Initializes the exception with a descriptive message.

 : mixed
Methods

forUnableToForkWorker()

Public Static

Creates an exception for failed worker fork attempts.

public static forUnableToForkWorker() : self

Description

Worker creation MUST succeed before the library can continue process orchestration. If the underlying fork operation fails, this exception MUST be thrown to indicate that no valid worker process could be established.

Return values
self

Description

a new instance describing the fork failure

forUndetectableProcessIdentifier()

Public Static

Creates an exception for failures while resolving the current PID.

public static forUndetectableProcessIdentifier() : self

Description

The library MUST be able to determine the current process identifier to distinguish master and worker execution contexts correctly. If PID detection fails, continued execution SHALL NOT be considered reliable.

Return values
self

Description

a new instance describing the PID detection failure

forUnsupportedForking()

Public Static

Creates an exception for runtimes that cannot support process forking.

public static forUnsupportedForking() : self

Description

The current runtime MUST provide the capabilities required for safe worker process creation. If those capabilities are unavailable, the library SHALL reject the operation by raising this exception.

Return values
self

Description

a new instance describing the unsupported runtime

forWorkerOutputAllocationFailure()

Public Static

Creates an exception for failures while allocating worker output transport.

public static forWorkerOutputAllocationFailure() : self

Description

Worker output transport resources MUST be allocated before output can be captured or monitored safely. If transport allocation fails, this exception SHALL indicate that the worker communication channel could not be prepared.

Return values
self

Description

a new instance describing the output transport allocation failure

forWorkersWaitFailure()

Public Static

Creates an exception for failures while waiting on multiple workers.

public static forWorkersWaitFailure( string  $error) : self

Description

Group wait operations SHOULD reconcile all targeted workers in a predictable manner. If the aggregate wait operation fails, this exception MUST communicate the underlying error so the caller can handle the runtime failure explicitly.

Parameters
$error : string

Description

the low-level error message associated with the group wait failure

Return values
self

Description

a new instance describing the multi-worker wait failure

forWorkerWaitFailure()

Public Static

Creates an exception for failures while waiting on a specific worker.

public static forWorkerWaitFailure( int  $workerPid, string  $error) : self

Description

Waiting on an individual worker SHOULD complete successfully when the worker is under manager control. If the wait operation fails, the library SHALL raise this exception with contextual error information.

Parameters
$workerPid : int

Description

the process identifier of the worker that could not be awaited successfully

$error : string

Description

the low-level error message associated with the wait failure

Return values
self

Description

a new instance describing the worker wait failure

__construct()

Private

Initializes the exception with a descriptive message.

private __construct( string  $message) : mixed

Description

This constructor is private to enforce the use of named constructors for specific logic violation scenarios, ensuring that each exception instance is created with a clear and relevant message.

Parameters
$message : string