Skip to content

Commit

Permalink
CC-22501: Fixing error handling while console terminate event (#9697)
Browse files Browse the repository at this point in the history
CC-22501 Fixing error handling while console terminate event
  • Loading branch information
michbeck authored Oct 28, 2022
1 parent 69beb69 commit de20ddc
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"cs-check": "phpcs -p -s --standard=vendor/spryker/code-sniffer/Spryker/ruleset.xml src/",
"cs-fix": "phpcbf -p --standard=vendor/spryker/code-sniffer/Spryker/ruleset.xml src/"
"cs-check": "phpcs -p -s --standard=vendor/spryker/code-sniffer/SprykerStrict/ruleset.xml src/",
"cs-fix": "phpcbf -p --standard=vendor/spryker/code-sniffer/SprykerStrict/ruleset.xml src/"
},
"extra": {
"branch-alias": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

namespace Spryker\Zed\Monitoring\Business\EventHandler;

use Error;
use Generated\Shared\Transfer\MonitoringTransactionEventTransfer;
use Spryker\Service\Monitoring\MonitoringServiceInterface;
use Spryker\Zed\Monitoring\Dependency\Service\MonitoringToUtilNetworkServiceInterface;
Expand Down Expand Up @@ -76,7 +77,12 @@ public function handleConsoleTerminateEvent(ConsoleTerminateEvent $event): void
*/
protected function getTransactionName(ConsoleTerminateEvent $event): string
{
$monitoringTransactionEventTransfer = $this->mapConsoleTerminateEventToMonitoringTransactionEventTransfer($event);
try {
$monitoringTransactionEventTransfer = $this->mapConsoleTerminateEventToMonitoringTransactionEventTransfer($event);
} catch (Error $e) {
return static::TRANSACTION_NAME_PREFIX . $event->getCommand()->getName();
}

foreach ($this->monitoringTransactionNamingStrategies as $monitoringTransactionNamingStrategy) {
if ($monitoringTransactionNamingStrategy->isApplicable($monitoringTransactionEventTransfer)) {
return $monitoringTransactionNamingStrategy->getMonitoringTransactionName($monitoringTransactionEventTransfer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@

namespace Spryker\Zed\Monitoring\Dependency\Facade;

use Generated\Shared\Transfer\StoreTransfer;

interface MonitoringToStoreFacadeInterface
{
/**
* @return \Generated\Shared\Transfer\StoreTransfer
*/
public function getCurrentStore();
public function getCurrentStore(): StoreTransfer;
}
3 changes: 3 additions & 0 deletions tooling.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
architecture-sniffer:
priority: 2

code-sniffer:
level: 2

0 comments on commit de20ddc

Please sign in to comment.