Skip to content

Commit

Permalink
Fix Adyen#23 PW-2747 Improve exception logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Rune Laenen committed Aug 11, 2020
1 parent d8fe558 commit d54d36d
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 8 deletions.
9 changes: 8 additions & 1 deletion Components/Adyen/PaymentMethodService.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,14 @@ public function getPaymentMethods(
try {
$paymentMethods = $checkout->paymentMethods($requestParams);
} catch (AdyenException $e) {
$this->logger->critical($e);
$this->logger->critical('Adyen Exception', [
'message' => $e->getMessage(),
'file' => $e->getFile(),
'line' => $e->getLine(),
'statuc' => $e->getStatus(),

This comment has been minimized.

Copy link
@wannevancamp

wannevancamp Aug 11, 2020

@runelaenen this line contains a typo and is a duplicate, can be removed

'errorType' => $e->getErrorType(),
'status' => $e->getStatus()
]);
return [];
}

Expand Down
6 changes: 5 additions & 1 deletion Components/NotificationProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,11 @@ private function process(Notification $notification)
} catch (\Exception $exception) {
$status = NotificationStatus::STATUS_FATAL;
$this->logger->notice('General Exception', [
'exception' => $exception,
'exception' => [
'message' => $exception->getMessage(),
'file' => $exception->getFile(),
'line' => $exception->getLine()
],
'notificationId' => $notification->getId()
]);
yield new NotificationProcessorFeedback(
Expand Down
6 changes: 5 additions & 1 deletion Components/ShopwareVersionCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ public function isHigherThanShopwareVersion(string $shopwareVersion): bool
list($composerVersion, $sha) = explode('@', Versions::getVersion('shopware/shopware'));
$version = $composerVersion;
} catch (OutOfBoundsException $ex) {
$this->logger->error($ex);
$this->logger->error('OutOfBoundsException', [
'message' => $ex->getMessage(),
'file' => $ex->getFile(),
'line' => $ex->getLine()
]);
}
}

Expand Down
11 changes: 8 additions & 3 deletions Controllers/Frontend/Adyen.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,17 @@ public function ajaxDoPaymentAction()
'content' => $paymentInfo
]
));
} catch (\Adyen\AdyenException $e) {
$this->logger->debug($e);
} catch (\Adyen\AdyenException $ex) {
$this->logger->debug('AdyenException during doPayment', [
'message' => $ex->getMessage(),
'file' => $ex->getFile(),
'line' => $ex->getLine()
]);

$this->Response()->setBody(json_encode(
[
'status' => 'error',
'content' => $e->getMessage()
'content' => $ex->getMessage()
]
));
}
Expand Down
8 changes: 6 additions & 2 deletions Subscriber/BackendConfigSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,12 @@ public function onBackendConfig(\Enlight_Event_EventArgs $args)
) {
try {
$this->originKeysService->generateAndSave();
} catch (AdyenException $e) {
$this->logger->error($e);
} catch (AdyenException $ex) {
$this->logger->error('AdyenException on Backend Config', [
'message' => $ex->getMessage(),
'file' => $ex->getFile(),
'line' => $ex->getLine()
]);
}

if ($this->shopwareVersionCheck->isHigherThanShopwareVersion('v5.5.6')) {
Expand Down

0 comments on commit d54d36d

Please sign in to comment.