mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-07 14:41:20 +00:00
Code cleanup that (hopefully) matches style CI
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
namespace FireflyIII\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
@@ -27,5 +28,4 @@ use Exception;
|
||||
*/
|
||||
class DuplicateTransactionException extends Exception
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ use Exception;
|
||||
|
||||
/**
|
||||
* Class FireflyException.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class FireflyException extends Exception
|
||||
|
||||
@@ -33,8 +33,11 @@ use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Redirector;
|
||||
use Log;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* Class GracefulNotFoundHandler
|
||||
@@ -134,7 +137,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
|
||||
* @param Request $request
|
||||
* @param Exception $exception
|
||||
*
|
||||
* @return \Illuminate\Http\Response|\Symfony\Component\HttpFoundation\Response
|
||||
* @return \Illuminate\Http\Response|Response
|
||||
*/
|
||||
private function handleAccount($request, Exception $exception)
|
||||
{
|
||||
@@ -142,7 +145,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
$route = $request->route();
|
||||
$accountId = (int)$route->parameter('account');
|
||||
$accountId = (int) $route->parameter('account');
|
||||
/** @var Account $account */
|
||||
$account = $user->accounts()->with(['accountType'])->withTrashed()->find($accountId);
|
||||
if (null === $account) {
|
||||
@@ -163,7 +166,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
$route = $request->route();
|
||||
$attachmentId = (int)$route->parameter('attachment');
|
||||
$attachmentId = (int) $route->parameter('attachment');
|
||||
/** @var Attachment $attachment */
|
||||
$attachment = $user->attachments()->withTrashed()->find($attachmentId);
|
||||
if (null === $attachment) {
|
||||
@@ -199,7 +202,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
|
||||
* @param $request
|
||||
* @param Exception $exception
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\Response|\Illuminate\Routing\Redirector|\Symfony\Component\HttpFoundation\Response
|
||||
* @return RedirectResponse|\Illuminate\Http\Response|Redirector|Response
|
||||
*/
|
||||
private function handleGroup($request, Exception $exception)
|
||||
{
|
||||
@@ -207,7 +210,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
$route = $request->route();
|
||||
$groupId = (int)$route->parameter('transactionGroup');
|
||||
$groupId = (int) $route->parameter('transactionGroup');
|
||||
|
||||
/** @var TransactionGroup $group */
|
||||
$group = $user->transactionGroups()->withTrashed()->find($groupId);
|
||||
|
||||
@@ -82,15 +82,17 @@ class Handler extends ExceptionHandler
|
||||
'line' => $exception->getLine(),
|
||||
'file' => $exception->getFile(),
|
||||
'trace' => $exception->getTrace(),
|
||||
], 500
|
||||
],
|
||||
500
|
||||
);
|
||||
}
|
||||
|
||||
return response()->json(['message' => 'Internal Firefly III Exception. See log files.', 'exception' => get_class($exception)], 500);
|
||||
}
|
||||
|
||||
if($exception instanceof NotFoundHttpException) {
|
||||
if ($exception instanceof NotFoundHttpException) {
|
||||
$handler = app(GracefulNotFoundHandler::class);
|
||||
|
||||
return $handler->render($request, $exception);
|
||||
}
|
||||
|
||||
@@ -113,13 +115,12 @@ class Handler extends ExceptionHandler
|
||||
*
|
||||
* @param Exception $exception
|
||||
*
|
||||
* @throws Exception
|
||||
* @return mixed|void
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function report(Exception $exception)
|
||||
{
|
||||
|
||||
$doMailError = config('firefly.send_error_message');
|
||||
// if the user wants us to mail:
|
||||
if (true === $doMailError
|
||||
@@ -149,7 +150,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);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ use Exception;
|
||||
|
||||
/**
|
||||
* Class NotImplementedException.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class NotImplementedException extends Exception
|
||||
|
||||
@@ -28,6 +28,7 @@ use Exception;
|
||||
|
||||
/**
|
||||
* Class ValidationExceptions.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class ValidationException extends Exception
|
||||
|
||||
Reference in New Issue
Block a user