generated from chevere/package-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
workflow exception wraps error, provides access
- Loading branch information
Showing
2 changed files
with
59 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Chevere. | ||
* | ||
* (c) Rodolfo Berrios <rodolfo@chevere.org> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Chevere\Workflow\Exceptions; | ||
|
||
use Chevere\Workflow\Interfaces\JobInterface; | ||
use Exception; | ||
use Throwable; | ||
|
||
/** | ||
* Exception thrown when validating Workflow runtime. | ||
*/ | ||
final class WorkflowException extends Exception | ||
{ | ||
/** | ||
* The job name that thrown the exception. | ||
*/ | ||
public readonly string $name; | ||
|
||
/** | ||
* The job that thrown the exception. | ||
*/ | ||
public readonly JobInterface $job; | ||
|
||
/** | ||
* The exception thrown by the job. | ||
*/ | ||
public readonly Throwable $throwable; | ||
|
||
public function __construct( | ||
string $name, | ||
JobInterface $job, | ||
string $message, | ||
Throwable $throwable, | ||
) { | ||
parent::__construct(message: $message, previous: $throwable); | ||
$this->name = $name; | ||
$this->job = $job; | ||
$this->throwable = $throwable; | ||
$this->file = $job->caller()->file(); | ||
$this->line = $job->caller()->line(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters