Documentation

BaseException extends Exception

Base Exception for TiqUtilities package

This class serves as the foundation for all custom exceptions in the TiqUtilities package. It extends the PHP's built-in Exception class and provides additional functionality for consistent error handling across the application.

Use this class as the parent for all domain-specific exceptions in TiqUtilities to ensure consistent behavior and to simplify exception catching.

Table of Contents

Properties

$context  : array<string|int, mixed>

Methods

__construct()  : mixed
BaseException constructor.
addContext()  : $this
Add additional context data to the exception
format()  : string
Format the exception for logging or display
getContext()  : array<string|int, mixed>
Get additional context data for the exception

Properties

$context

protected array<string|int, mixed> $context = []

Additional context data for the exception

Methods

__construct()

BaseException constructor.

public __construct(string $message[, int $code = 0 ][, Throwable|null $previous = null ][, array<string|int, mixed> $context = [] ]) : mixed
Parameters
$message : string

The exception message

$code : int = 0

The exception code

$previous : Throwable|null = null

Previous exception used for exception chaining

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

Additional context data for debugging

addContext()

Add additional context data to the exception

public addContext(string $key, mixed $value) : $this
Parameters
$key : string

Context key

$value : mixed

Context value

Return values
$this

format()

Format the exception for logging or display

public format() : string
Return values
string

getContext()

Get additional context data for the exception

public getContext() : array<string|int, mixed>
Return values
array<string|int, mixed>

        
On this page

Search results