Use Throwable instead of \Exception

[MAILPOET-4463]
This commit is contained in:
John Oleksowicz
2022-09-12 12:55:00 -05:00
committed by Jan Jakeš
parent 2c2f15a562
commit 8cbbe5aa6e
3 changed files with 9 additions and 8 deletions

View File

@ -4,6 +4,7 @@ namespace MailPoet\Automation\Engine\Data;
use DateTimeImmutable;
use MailPoet\Automation\Engine\Utils\Json;
use Throwable;
class WorkflowRunLog {
@ -131,13 +132,13 @@ class WorkflowRunLog {
$this->completedAt = new DateTimeImmutable();
}
public function addError(\Exception $exception, string $userFacingMessage = ''): void {
public function addError(Throwable $error, string $userFacingMessage = ''): void {
$error = [
'message' => $exception->getMessage(),
'exceptionClass' => get_class($exception),
'message' => $error->getMessage(),
'errorClass' => get_class($error),
'userFacingMessage' => $userFacingMessage,
'code' => $exception->getCode(),
'trace' => $exception->getTrace(),
'code' => $error->getCode(),
'trace' => $error->getTrace(),
];
$this->errors[] = $error;