Rethrow integration log exceptions in debug mode

[MAILPOET-5568]
This commit is contained in:
Jan Jakes
2023-09-12 15:26:01 +02:00
committed by Aschepikov
parent 701984523f
commit 944b440bdf
2 changed files with 33 additions and 3 deletions

View File

@@ -32,13 +32,17 @@ class StepRunLogger {
/** @var int */
private $runNumber;
/** @var bool */
private $isWpDebug;
public function __construct(
AutomationRunLogStorage $automationRunLogStorage,
Hooks $hooks,
int $runId,
string $stepId,
string $stepType,
int $runNumber
int $runNumber,
bool $isWpDebug = WP_DEBUG
) {
$this->automationRunLogStorage = $automationRunLogStorage;
$this->hooks = $hooks;
@@ -46,6 +50,7 @@ class StepRunLogger {
$this->stepId = $stepId;
$this->stepType = $stepType;
$this->runNumber = $runNumber;
$this->isWpDebug = $isWpDebug;
}
public function logStart(): void {
@@ -106,7 +111,10 @@ class StepRunLogger {
try {
$this->hooks->doAutomationStepAfterRun($log);
} catch (Throwable $e) {
// ignore integration errors
if ($this->isWpDebug) {
throw $e;
}
// ignore integration logging errors
}
}
}