Update exception handling in Handler and TestEmailController for improved error reporting
All checks were successful
Deploy Production (crewsportswear.com) / deploy (push) Successful in 1m51s

This commit is contained in:
Frank John Begornia
2026-02-26 22:58:28 +08:00
parent 47b354d8b7
commit 701a433174
2 changed files with 10 additions and 4 deletions

View File

@@ -22,8 +22,11 @@ class Handler extends ExceptionHandler {
* @param \Exception $e
* @return void
*/
public function report(Exception $e)
public function report($e)
{
if (!$e instanceof Exception) {
$e = new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine());
}
return parent::report($e);
}
@@ -31,11 +34,14 @@ class Handler extends ExceptionHandler {
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $e
* @param mixed $e
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $e)
public function render($request, $e)
{
if (!$e instanceof Exception) {
$e = new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine());
}
return parent::render($request, $e);
}

View File

@@ -36,7 +36,7 @@ class TestEmailController extends Controller
$status = 'success';
$message = 'Test email sent successfully to ' . $recipient . '.';
} catch (\Exception $e) {
} catch (\Throwable $e) {
$status = 'danger';
$message = 'Failed to send email: ' . $e->getMessage();
}