mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-10-31 02:36:28 +00:00 
			
		
		
		
	Catch the error in #760
This commit is contained in:
		| @@ -85,6 +85,7 @@ class ImportJournal | ||||
|  | ||||
|     /** | ||||
|      * @return string | ||||
|      * @throws FireflyException | ||||
|      */ | ||||
|     public function getAmount(): string | ||||
|     { | ||||
| @@ -102,6 +103,9 @@ class ImportJournal | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         if(bccomp($this->amount,'0') === 0) { | ||||
|             throw new FireflyException('Amount is zero.'); | ||||
|         } | ||||
|  | ||||
|         return $this->amount; | ||||
|     } | ||||
|   | ||||
| @@ -11,6 +11,8 @@ declare(strict_types=1); | ||||
|  | ||||
| namespace FireflyIII\Import\Storage; | ||||
|  | ||||
| use ErrorException; | ||||
| use Exception; | ||||
| use FireflyIII\Exceptions\FireflyException; | ||||
| use FireflyIII\Import\Object\ImportJournal; | ||||
| use FireflyIII\Models\ImportJob; | ||||
| @@ -95,7 +97,7 @@ class ImportStorage | ||||
|             function (ImportJournal $importJournal, int $index) { | ||||
|                 try { | ||||
|                     $this->storeImportJournal($index, $importJournal); | ||||
|                 } catch (FireflyException $e) { | ||||
|                 } catch (FireflyException | ErrorException | Exception $e) { | ||||
|                     $this->errors->push($e->getMessage()); | ||||
|                     Log::error(sprintf('Cannot import row #%d because: %s', $index, $e->getMessage())); | ||||
|                 } | ||||
|   | ||||
| @@ -214,7 +214,7 @@ trait ImportSupport | ||||
|      */ | ||||
|     private function getTransactionType(string $amount, Account $account): string | ||||
|     { | ||||
|         $transactionType = ''; | ||||
|         $transactionType = TransactionType::WITHDRAWAL; | ||||
|         // amount is negative, it's a withdrawal, opposing is an expense: | ||||
|         if (bccomp($amount, '0') === -1) { | ||||
|             $transactionType = TransactionType::WITHDRAWAL; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user