-
Notifications
You must be signed in to change notification settings - Fork 35
Docs ‐ Exception Handler
Isaac Sai edited this page Jan 21, 2024
·
3 revisions
Bugs can appear in software, causing them to crush. Laravel USSD allows us to handle any exception that may arrive in running of our application and return the error we want to show the users.
php artisan ussd:exception-handler CatchExceptionHandler
Implement how exception should be handled.
<?php
namespace App\Ussd;
use Exception;
use Sparors\Ussd\Contracts\ExceptionHandler;
class CatchExceptionHandler implements ExceptionHandler
{
public function handle(Exception $exception): string
{
return 'Sorry, something when wrong: '.$exception->getMessage();
}
}