Skip to content

Commit

Permalink
Fix issue with GenericError from the inside of Task closure and updat…
Browse files Browse the repository at this point in the history
…e deps
  • Loading branch information
donhardman committed Jan 18, 2024
1 parent a8db5d1 commit 8014c8d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 28 deletions.
50 changes: 25 additions & 25 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions src/Task/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,15 @@ function (): void {
$this->result = $fn(...$argv);
} catch (Throwable $t) {
[$errorClass, $errorMessage] = [$t::class, $t->getMessage()];
$e = new GenericError("$errorClass: $errorMessage");
if ($errorMessage) {
$e->setResponseError($errorMessage);
if ($t instanceof GenericError) {
$e = $t;
} else {
$e = new GenericError("$errorClass: $errorMessage");
if ($errorMessage) {
$e->setResponseError($errorMessage);
}
}

$this->error = $e;
} finally {
$this->status = TaskStatus::Finished;
Expand Down

0 comments on commit 8014c8d

Please sign in to comment.