-
-
Notifications
You must be signed in to change notification settings - Fork 52
Added NonRetryableException #192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Removed RemovedExceptions Count $this->assertCount(1, $workflow->exceptions()); Because it reports as 2 exceptions
Sorry for the delay. I have not forgotten about this! |
Thank you! This will be a helpful addition to this project. Would you consider making an interface/contract that can mark any exception class as NonRetryable? That would allow us to make any existing exception class NonRetryable without having to extend the NonRetryable class (which may be difficult if the exception is already extending a different base class). Here's what it would look like:
<?php
declare(strict_types=1);
namespace Workflow\Exceptions;
use Exception;
use Throwable;
class NonRetryableException extends Exception implements NonRetryableExceptionContract
{
public function __construct($message = '', $code = 0, Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
}
}
<?php
declare(strict_types=1);
namespace Workflow\Exceptions;
interface NonRetryableExceptionContract {} In if ($throwable instanceof NonRetryableExceptionContract) {
$this->fail($throwable);
} With this change, you can still throw a |
@travisaustin This is a really nice suggestion. I will improve my PR to add that. |
@rmcdaniel It would be really nice if you take out sometime to review this PR? Thanks a lot |
@rmcdaniel |
I'm going to try to get to it this week. I will also be pushing out a new release. Thank you for your patience! |
@BenQoder Hey there, as promised I have merged this, published a new release and I have also updated the documentation at https://laravel-workflow.com/docs/failures-and-recovery/#non-retryable-exceptions Thanks for your contribution! 🙌 |
It's cool... 👍🏾 Finally I can stop using my fork and change to the updated version. |
The PR adds NonRetryableException.
When this exception is thrown, The Activity will not retry and The Workflow Marks as Fail.
This implementation will work similarly to Cloudflare Workflow NonRetryableError
NonRetryableException