Renames ManagedEnvironment context badge to Environment context as requested. Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #431
30 lines
701 B
PHP
30 lines
701 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Jobs\Concerns;
|
|
|
|
use App\Models\OperationRun;
|
|
use App\Services\OperationRunService;
|
|
use App\Support\Operations\OperationRunCorrelationResolver;
|
|
use Throwable;
|
|
|
|
trait BridgesFailedOperationRun
|
|
{
|
|
public function failed(Throwable $exception): void
|
|
{
|
|
$operationRun = $this->failedBridgeOperationRun();
|
|
|
|
if (! $operationRun instanceof OperationRun) {
|
|
return;
|
|
}
|
|
|
|
app(OperationRunService::class)->bridgeFailedJobFailure($operationRun, $exception);
|
|
}
|
|
|
|
protected function failedBridgeOperationRun(): ?OperationRun
|
|
{
|
|
return app(OperationRunCorrelationResolver::class)->resolve($this);
|
|
}
|
|
}
|