Catch various errors.

This commit is contained in:
James Cole
2018-07-26 06:27:52 +02:00
parent 6bcfea1de4
commit 89be30c4b9
19 changed files with 76 additions and 50 deletions

View File

@@ -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());

View File

@@ -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());
}

View File

@@ -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());
}