mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Catch various errors.
This commit is contained in:
@@ -25,8 +25,6 @@ namespace FireflyIII\Services\Bunq;
|
||||
|
||||
use bunq\Context\ApiContext as BunqApiContext;
|
||||
use bunq\Context\BunqContext;
|
||||
use bunq\Exception\BadRequestException;
|
||||
use bunq\Exception\BunqException;
|
||||
use bunq\Util\BunqEnumApiEnvironmentType;
|
||||
use Exception;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
@@ -39,6 +37,7 @@ use Log;
|
||||
*/
|
||||
class ApiContext
|
||||
{
|
||||
/** @noinspection MoreThanThreeArgumentsInspection */
|
||||
/**
|
||||
* @param BunqEnumApiEnvironmentType $environmentType
|
||||
* @param string $apiKey
|
||||
@@ -50,11 +49,11 @@ class ApiContext
|
||||
* @return BunqApiContext
|
||||
*/
|
||||
public function create(BunqEnumApiEnvironmentType $environmentType, string $apiKey, string $description, array $permittedIps, string $proxyUrl = null
|
||||
) {
|
||||
): BunqApiContext {
|
||||
$permittedIps = $permittedIps ?? [];
|
||||
try {
|
||||
$context = BunqApiContext::create($environmentType, $apiKey, $description, $permittedIps, $proxyUrl);
|
||||
} catch (BunqException|BadRequestException|Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$message = $e->getMessage();
|
||||
Log::error($message);
|
||||
Log::error($e->getTraceAsString());
|
||||
@@ -78,7 +77,7 @@ class ApiContext
|
||||
try {
|
||||
$apiContext = BunqApiContext::fromJson($jsonString);
|
||||
BunqContext::loadApiContext($apiContext);
|
||||
} catch (BadRequestException|BunqException|Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$message = $e->getMessage();
|
||||
Log::error($message);
|
||||
Log::error($e->getTraceAsString());
|
||||
|
||||
@@ -23,7 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Services\Bunq;
|
||||
|
||||
use bunq\Exception\BunqException;
|
||||
|
||||
use bunq\Model\Generated\Endpoint\BunqResponseMonetaryAccountList;
|
||||
use bunq\Model\Generated\Endpoint\MonetaryAccount as BunqMonetaryAccount;
|
||||
use Exception;
|
||||
@@ -47,7 +47,7 @@ class MonetaryAccount
|
||||
$customHeaders = $customHeaders ?? [];
|
||||
try {
|
||||
$result = BunqMonetaryAccount::listing($params, $customHeaders);
|
||||
} catch (BunqException|Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw new FireflyException($e->getMessage());
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Services\Bunq;
|
||||
|
||||
use bunq\Exception\BunqException;
|
||||
|
||||
use bunq\Model\Generated\Endpoint\BunqResponsePaymentList;
|
||||
use bunq\Model\Generated\Endpoint\Payment as BunqPayment;
|
||||
use Exception;
|
||||
@@ -49,7 +49,7 @@ class Payment
|
||||
$customHeaders = $customHeaders ?? [];
|
||||
try {
|
||||
$result = BunqPayment::listing($monetaryAccountId, $params, $customHeaders);
|
||||
} catch (BunqException|Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw new FireflyException($e->getMessage());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user