Update exception handling in Handler and TestEmailController for improved error reporting
All checks were successful
Deploy Production (crewsportswear.com) / deploy (push) Successful in 1m51s
All checks were successful
Deploy Production (crewsportswear.com) / deploy (push) Successful in 1m51s
This commit is contained in:
@@ -22,8 +22,11 @@ class Handler extends ExceptionHandler {
|
|||||||
* @param \Exception $e
|
* @param \Exception $e
|
||||||
* @return void
|
* @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);
|
return parent::report($e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,11 +34,14 @@ class Handler extends ExceptionHandler {
|
|||||||
* Render an exception into an HTTP response.
|
* Render an exception into an HTTP response.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
* @param \Exception $e
|
* @param mixed $e
|
||||||
* @return \Illuminate\Http\Response
|
* @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);
|
return parent::render($request, $e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class TestEmailController extends Controller
|
|||||||
|
|
||||||
$status = 'success';
|
$status = 'success';
|
||||||
$message = 'Test email sent successfully to ' . $recipient . '.';
|
$message = 'Test email sent successfully to ' . $recipient . '.';
|
||||||
} catch (\Exception $e) {
|
} catch (\Throwable $e) {
|
||||||
$status = 'danger';
|
$status = 'danger';
|
||||||
$message = 'Failed to send email: ' . $e->getMessage();
|
$message = 'Failed to send email: ' . $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user