Sha256: 3abbe37a551d0e601c8bb3f5b7274bd07039e5c057b51b8d187590fe692ffac0

Contents?: true

Size: 859 Bytes

Versions: 1

Compression:

Stored size: 859 Bytes

Contents

# Error handling

Wayfarer relies on Active Job's error handling facilities, `retry_on` and
`discard_on`:

* [Active Job Basics: Exceptions](https://guides.rubyonrails.org/active_job_basics.html#exceptions)
* [ActiveJob::Exceptions](https://edgeapi.rubyonrails.org/classes/ActiveJob/Exceptions/ClassMethods.html)

## Retrying

```ruby
class DummyJob < Wayfarer::Base
  retry_on MyError, attempts: 3 do |job, error|
    # All 3 attempts have failed (1 initial attempt + 2 retries)
  end
end
```

## Discarding

```ruby
class DummyJob < Wayfarer::Base
  discard_on MyError do |job, error|
    # The job will not get retried
  end
end
```

## Job failures

Jobs are not retried and their URLs locked within their batch if:

* A discarded exception is raised.
* An unhandled exception is raised.
* A handled exception is raised, but retry attempts are exhausted.

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wayfarer-0.4.1 docs/guides/error_handling.md