Skip to content

Firefly III: a personal finances manager

Throw a 410. Don't report it.

James Coleabacfa212e6f
diff --git a/app/Api/V1/Controllers/Models/Transaction/StoreController.php b/app/Api/V1/Controllers/Models/Transaction/StoreController.php
index 99aa685815..9f683f6916 100644
--- a/app/Api/V1/Controllers/Models/Transaction/StoreController.php
+++ b/app/Api/V1/Controllers/Models/Transaction/StoreController.php
@@ -24,7 +24,6 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers\Models\Transaction;
-use FireflyIII\Models\TransactionGroup;
use Illuminate\Http\Request;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Models\Transaction\StoreRequest;
@@ -45,7 +44,7 @@ use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\ValidationException;
use League\Fractal\Resource\Item;
-use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
+use Symfony\Component\HttpKernel\Exception\HttpException;
/**
* Class StoreController
@@ -133,10 +132,9 @@ class StoreController extends Controller
->withAPIInformation()
;
- /** @var TransactionGroup $selectedGroup */
$selectedGroup = $collector->getGroups()->first();
if (null === $selectedGroup) {
- throw new NotFoundHttpException();
+ throw HttpException::fromStatusCode(410,'200032: Cannot find transaction. Possibly, a rule deleted this transaction after its creation.');
}
// enrich
diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php
index e17ced5d89..3089ca41b7 100644
--- a/app/Exceptions/Handler.php
+++ b/app/Exceptions/Handler.php
@@ -45,6 +45,7 @@ use Override;
use Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
+use Symfony\Component\HttpKernel\Exception\GoneHttpException;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@@ -71,6 +72,7 @@ class Handler extends ExceptionHandler
AuthenticationException::class,
LaravelValidationException::class,
NotFoundHttpException::class,
+ GoneHttpException::class,
OAuthServerException::class,
LaravelOAuthException::class,
TokenMismatchException::class,