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
Example 1 Traditional Exception Throw
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
Example 2 Fault Manager
Fault::throw() methodtry {
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.
Example 3 Fault Manager
Fault::exception() methodtry {
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.