Quick Start
It is recommended to place use Omega\FaultManager\Fault;
in your PHP file in order to call
\Omega\FaultManager\Fault
class directly.
Traditional way
try {
throw new \Exception('Something bad happened!');
} catch (\Exception $exception) {
// Do some handling
}
Fault Manager approach
You can either use Fault::throw()
as shown in the below example
try {
Fault::throw(\Exception::class, 'Something bad happened!');
} catch (\Exception $exception) {
// Do some handling
}
Or if you feel that you prefer to have a more traditional way then you can use Fault::exception()
instead.
try {
throw Fault::exception(\Exception::class, 'Something bad happened!');
} catch (\Exception $exception) {
// Do some handling
}
But Fault Manager is not just an Exception factory… To learn more, continue to Reference.