mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-19 19:01:58 +00:00
Update error catch
This commit is contained in:
@@ -28,6 +28,7 @@ use Exception;
|
|||||||
use FireflyIII\Models\Transaction;
|
use FireflyIII\Models\Transaction;
|
||||||
use FireflyIII\Models\TransactionJournal;
|
use FireflyIII\Models\TransactionJournal;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Database\QueryException;
|
||||||
use Log;
|
use Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -77,7 +78,7 @@ class DeleteEmptyJournals extends Command
|
|||||||
// uneven number, delete journal and transactions:
|
// uneven number, delete journal and transactions:
|
||||||
try {
|
try {
|
||||||
TransactionJournal::find((int)$row->transaction_journal_id)->delete();
|
TransactionJournal::find((int)$row->transaction_journal_id)->delete();
|
||||||
} catch (Exception $e) {
|
} catch (QueryException $e) {
|
||||||
Log::info(sprintf('Could not delete journal: %s', $e->getMessage()));
|
Log::info(sprintf('Could not delete journal: %s', $e->getMessage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,7 +105,7 @@ class DeleteEmptyJournals extends Command
|
|||||||
foreach ($set as $entry) {
|
foreach ($set as $entry) {
|
||||||
try {
|
try {
|
||||||
TransactionJournal::find($entry->id)->delete();
|
TransactionJournal::find($entry->id)->delete();
|
||||||
} catch (Exception $e) {
|
} catch (QueryException $e) {
|
||||||
Log::info(sprintf('Could not delete entry: %s', $e->getMessage()));
|
Log::info(sprintf('Could not delete entry: %s', $e->getMessage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -27,6 +27,7 @@ use Exception;
|
|||||||
use FireflyIII\Models\Transaction;
|
use FireflyIII\Models\Transaction;
|
||||||
use FireflyIII\Models\TransactionJournal;
|
use FireflyIII\Models\TransactionJournal;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Database\QueryException;
|
||||||
use Log;
|
use Log;
|
||||||
use stdClass;
|
use stdClass;
|
||||||
|
|
||||||
@@ -147,7 +148,7 @@ class DeleteOrphanedTransactions extends Command
|
|||||||
if ($journal) {
|
if ($journal) {
|
||||||
try {
|
try {
|
||||||
$journal->delete();
|
$journal->delete();
|
||||||
} catch (Exception $e) {
|
} catch (QueryException $e) {
|
||||||
Log::info(sprintf('Could not delete journal %s', $e->getMessage()));
|
Log::info(sprintf('Could not delete journal %s', $e->getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -27,6 +27,7 @@ use Exception;
|
|||||||
use FireflyIII\Models\Transaction;
|
use FireflyIII\Models\Transaction;
|
||||||
use FireflyIII\Models\TransactionJournal;
|
use FireflyIII\Models\TransactionJournal;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Database\QueryException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class DeleteZeroAmount
|
* Class DeleteZeroAmount
|
||||||
@@ -62,7 +63,7 @@ class DeleteZeroAmount extends Command
|
|||||||
$this->info(sprintf('Deleted transaction journal #%d because the amount is zero (0.00).', $journal->id));
|
$this->info(sprintf('Deleted transaction journal #%d because the amount is zero (0.00).', $journal->id));
|
||||||
try {
|
try {
|
||||||
$journal->delete();
|
$journal->delete();
|
||||||
} catch (Exception $e) {
|
} catch (QueryException $e) {
|
||||||
$this->line($e->getMessage());
|
$this->line($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -229,7 +229,7 @@ class BackToJournals extends Command
|
|||||||
foreach ($chunks as $chunk) {
|
foreach ($chunks as $chunk) {
|
||||||
$set = DB::table('transactions')
|
$set = DB::table('transactions')
|
||||||
->whereIn('transactions.id', $chunk)
|
->whereIn('transactions.id', $chunk)
|
||||||
->get(['transaction_journal_id'])->pluck('transaction_journal_id')->toArray();
|
->pluck('transaction_journal_id')->toArray();
|
||||||
$array = array_merge($array, $set);
|
$array = array_merge($array, $set);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -28,6 +28,7 @@ use FireflyIII\Exceptions\FireflyException;
|
|||||||
use FireflyIII\Models\Note;
|
use FireflyIII\Models\Note;
|
||||||
use FireflyIII\Models\TransactionJournalMeta;
|
use FireflyIII\Models\TransactionJournalMeta;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
|
use Illuminate\Database\QueryException;
|
||||||
use Log;
|
use Log;
|
||||||
use Psr\Container\ContainerExceptionInterface;
|
use Psr\Container\ContainerExceptionInterface;
|
||||||
use Psr\Container\NotFoundExceptionInterface;
|
use Psr\Container\NotFoundExceptionInterface;
|
||||||
@@ -83,7 +84,7 @@ class MigrateJournalNotes extends Command
|
|||||||
Log::debug(sprintf('Migrated meta note #%d to Note #%d', $meta->id, $note->id));
|
Log::debug(sprintf('Migrated meta note #%d to Note #%d', $meta->id, $note->id));
|
||||||
try {
|
try {
|
||||||
$meta->delete();
|
$meta->delete();
|
||||||
} catch (Exception $e) {
|
} catch (QueryException $e) {
|
||||||
Log::error(sprintf('Could not delete old meta entry #%d: %s', $meta->id, $e->getMessage()));
|
Log::error(sprintf('Could not delete old meta entry #%d: %s', $meta->id, $e->getMessage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user