mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-05 12:12:18 +00:00
Various code cleanup.
This commit is contained in:
@@ -45,6 +45,8 @@ class GracefulNotFoundHandler extends ExceptionHandler
|
||||
* @param Request $request
|
||||
*
|
||||
* @throws \Throwable
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||
*/
|
||||
public function render($request, \Throwable $e): Response
|
||||
{
|
||||
|
@@ -65,11 +65,15 @@ class Handler extends ExceptionHandler
|
||||
];
|
||||
|
||||
/**
|
||||
* Render an exception into an HTTP response.
|
||||
* Render an exception into an HTTP response. It's complex but lucky for us, we never use it because
|
||||
* Firefly III never crashes.
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @throws \Throwable
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.NPathComplexity)
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||
*/
|
||||
public function render($request, \Throwable $e): Response
|
||||
{
|
||||
@@ -124,7 +128,7 @@ class Handler extends ExceptionHandler
|
||||
$errorCode = 500;
|
||||
$errorCode = $e instanceof MethodNotAllowedHttpException ? 405 : $errorCode;
|
||||
|
||||
$isDebug = (bool)config('app.debug', false);
|
||||
$isDebug = (bool) config('app.debug', false);
|
||||
if ($isDebug) {
|
||||
app('log')->debug(sprintf('Return JSON %s with debug.', get_class($e)));
|
||||
|
||||
@@ -181,7 +185,7 @@ class Handler extends ExceptionHandler
|
||||
*/
|
||||
public function report(\Throwable $e): void
|
||||
{
|
||||
$doMailError = (bool)config('firefly.send_error_message');
|
||||
$doMailError = (bool) config('firefly.send_error_message');
|
||||
if ($this->shouldntReportLocal($e) || !$doMailError) {
|
||||
parent::report($e);
|
||||
|
||||
@@ -216,7 +220,7 @@ class Handler extends ExceptionHandler
|
||||
|
||||
// create job that will mail.
|
||||
$ipAddress = request()->ip() ?? '0.0.0.0';
|
||||
$job = new MailError($userData, (string)config('firefly.site_owner'), $ipAddress, $data);
|
||||
$job = new MailError($userData, (string) config('firefly.site_owner'), $ipAddress, $data);
|
||||
dispatch($job);
|
||||
|
||||
parent::report($e);
|
||||
|
Reference in New Issue
Block a user