Catch and verify various errors

This commit is contained in:
James Cole
2023-01-21 12:21:06 +01:00
parent c269913510
commit f9daf7751a
12 changed files with 33 additions and 27 deletions

View File

@@ -73,7 +73,7 @@ class AttemptController extends Controller
public function index(Webhook $webhook, WebhookMessage $message): JsonResponse
{
if ($message->webhook_id !== $webhook->id) {
throw new FireflyException('Webhook and webhook message are no match');
throw new FireflyException('200040: Webhook and webhook message are no match');
}
$manager = $this->getManager();
@@ -112,10 +112,10 @@ class AttemptController extends Controller
public function show(Webhook $webhook, WebhookMessage $message, WebhookAttempt $attempt): JsonResponse
{
if ($message->webhook_id !== $webhook->id) {
throw new FireflyException('Webhook and webhook message are no match');
throw new FireflyException('200040: Webhook and webhook message are no match');
}
if ($attempt->webhook_message_id !== $message->id) {
throw new FireflyException('Webhook message and webhook attempt are no match');
throw new FireflyException('200041: Webhook message and webhook attempt are no match');
}
$manager = $this->getManager();

View File

@@ -91,10 +91,10 @@ class DestroyController extends Controller
public function destroyAttempt(Webhook $webhook, WebhookMessage $message, WebhookAttempt $attempt): JsonResponse
{
if ($message->webhook_id !== $webhook->id) {
throw new FireflyException('Webhook and webhook message are no match');
throw new FireflyException('200040: Webhook and webhook message are no match');
}
if ($attempt->webhook_message_id !== $message->id) {
throw new FireflyException('Webhook message and webhook attempt are no match');
throw new FireflyException('200041: Webhook message and webhook attempt are no match');
}
$this->repository->destroyAttempt($attempt);
@@ -119,7 +119,7 @@ class DestroyController extends Controller
public function destroyMessage(Webhook $webhook, WebhookMessage $message): JsonResponse
{
if ($message->webhook_id !== $webhook->id) {
throw new FireflyException('Webhook and webhook message are no match');
throw new FireflyException('200040: Webhook and webhook message are no match');
}
$this->repository->destroyMessage($message);
app('preferences')->mark();

View File

@@ -103,7 +103,7 @@ class MessageController extends Controller
public function show(Webhook $webhook, WebhookMessage $message): JsonResponse
{
if ($message->webhook_id !== $webhook->id) {
throw new FireflyException('Webhook and webhook message are no match');
throw new FireflyException('200040: Webhook and webhook message are no match');
}
$manager = $this->getManager();