\Omega\Exceptions ExceptionHandler

ExceptionHandler class.

The ExceptionHandler class provides utility methods for handling exceptions in Omega applications.

Summary

Methods
Properties
Constants
showThrowable
showValidationException
showFriendlyThrowable
No public properties found
No public constants found
No protected methods found
No protected properties found
No protected constants found
No private methods found
No private properties found
No private constants found

Methods

showThrowable()

showThrowable(\Throwable  $throwable) : mixed

Show Throwable.

This method handles and displays exceptions or errors based on the environment. In a development environment ('APP_ENV' === 'dev'), it displays detailed error information using the Whoops error handler. In other environments, it may perform different actions depending on the type of exception.

Parameters

\Throwable $throwable

Holds an instance of Throwable (Exception or Error).

Throws

\Throwable

Returns

mixed —

Returns a response or performs actions based on the exception type.

showValidationException()

showValidationException(\Omega\Validation\Exception\ValidationException  $exception) : mixed

Show Validation Exception.

This method handles ValidationExceptions by storing error messages in the session (if available) and redirecting back to the previous page. Useful for displaying validation errors to the user.

Parameters

\Omega\Validation\Exception\ValidationException $exception

Holds an instance of ValidationException.

Returns

mixed —

Returns a redirection or performs actions based on the exception.

showFriendlyThrowable()

showFriendlyThrowable(\Throwable  $throwable) : void

Initialize Whoops.

This method initializes the Whoops error handler for displaying user-friendly error pages in a development environment ('APP_ENV' === 'dev').

Parameters

\Throwable $throwable

Holds an instance of Throwable (Exception or Error).

Throws

\Throwable

Returns

void —