DataException
extends HTTPException
in package
Base exception for database operation failures.
Used for general data integrity and operation errors. Extends HTTPException with a 500 status code by default (indicating server error).
Tags
Table of Contents
Properties
- $more : mixed
Methods
- __construct() : mixed
- Initialize a database exception.
- throw() : never
- Throw an exception with flexible named arguments.
Properties
$more read-only
public
mixed
$more
= null
Methods
__construct()
Initialize a database exception.
public
__construct([string|null $msg = null ][, int|null $code = null ][, Exception|null $parent = null ][, mixed $more = null ]) : mixed
Parameters
- $msg : string|null = null
-
Error message. Defaults to 'duplicate'.
- $code : int|null = null
-
HTTP status code. Defaults to 500.
- $parent : Exception|null = null
-
Previous exception for chaining.
- $more : mixed = null
-
Additional context data for debugging.
throw()
Throw an exception with flexible named arguments.
public
static throw([int|null $code = null ][, string|null $msg = null ][, Throwable|null $parent = null ][, mixed $more = null ]) : never
Static factory method for elegant exception creation. Only non-null arguments are included in the constructor call, allowing clean fluent syntax without positional confusion or needing to pass null for skipped parameters.
Parameters
- $code : int|null = null
-
HTTP status code.
- $msg : string|null = null
-
Error message.
- $parent : Throwable|null = null
-
Previous exception for chaining.
- $more : mixed = null
-
Structured error metadata.
Tags
Return values
never —Always throws the constructed exception.