Errors
class Errors (View source)
The GenericDatabase\Helpers\Errors class provides static methods for manipulating error display settings
and throwing exceptions with error messages and locations.
Example Usage:
// Turn off error display
Errors::turnOff();
// Turn on error display
Errors::turnOn();
// Throw an exception and display the error message and location
Errors::throw(new Exception('An error occurred'));
// Throw a custom exception with a custom error message and display the error message and location
Errors::newThrow(new Exception('An error occurred'), 'Custom error message');
Main functionalities:
- Manipulating error display settings
- Throwing exceptions with error messages and locations
Methods:
setError(mixed $value): mixed: Sets the error display setting to the specified value and returns the previous value.turnOff(): mixed: Turns off error display by setting the error display setting to 0 and returns the previous value.turnOn(): mixed: Turns on error display by setting the error display setting to 1 and returns the previous value.throw(object $exception): never: Throws the specified exception and displays the error message and location.newThrow(object $exception, object $message): never: Throws a custom exception with the specified error message and displays the error message and location.
Fields:
error: Stores the previous error display setting.
Methods
static mixed
turnOff()
Turn off error display by setting the error display setting to 0.
static mixed
turnOn()
Turn on error display by setting the error display setting to 1.
static string|false
throw(object $exception, string|null $message = null)
Throw a custom exception with the specified error message and display the error message and location.
Details
static mixed
turnOff()
Turn off error display by setting the error display setting to 0.
static mixed
turnOn()
Turn on error display by setting the error display setting to 1.
static string|false
throw(object $exception, string|null $message = null)
Throw a custom exception with the specified error message and display the error message and location.