mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-23 18:28:49 +02:00
Dont throw an exception, if we can not retrieve an currency exchange rate, but show an meaningful flash message
This commit is contained in:
parent
0c5180bda4
commit
2b2fc6f1e6
3 changed files with 22 additions and 3 deletions
|
@ -39,6 +39,7 @@ use App\Services\LogSystem\TimeTravel;
|
|||
use App\Services\StructuralElementRecursionHelper;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Exchanger\Exception\ChainException;
|
||||
use Exchanger\Exception\Exception;
|
||||
use Exchanger\Exception\UnsupportedCurrencyPairException;
|
||||
use Omines\DataTablesBundle\DataTableFactory;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
|
@ -117,8 +118,8 @@ class CurrencyController extends BaseAdminController
|
|||
try {
|
||||
$this->exchangeRateUpdater->update($entity);
|
||||
$this->addFlash('info', 'currency.edit.exchange_rate_updated.success');
|
||||
} catch (ChainException $exception) {
|
||||
$exception = $exception->getExceptions()[0];
|
||||
} catch (Exception $exception) {
|
||||
//$exception = $exception->getExceptions()[0];
|
||||
if ($exception instanceof UnsupportedCurrencyPairException || false !== stripos($exception->getMessage(), 'supported')) {
|
||||
$this->addFlash('error', 'currency.edit.exchange_rate_update.unsupported_currency');
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue