Sha256: e4660342f1382ee039fb3c423f058521370bb0a1dd9c03bdfaae73d17d3aec0a

Contents?: true

Size: 817 Bytes

Versions: 4

Compression:

Stored size: 817 Bytes

Contents

# Error handling

## Wayfarer never swallows exceptions

* Wayfarer never swallows exceptions.
* Jobs with unhandled exceptions are not retried.

## Retrying and discarding

Wayfarer relies on [Active Job's two error handling facilities](https://guides.rubyonrails.org/active_job_basics.html#exceptions).

* `retry_on` to retry jobs a number of times on certain errors:

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

* `discard_on` to throw away jobs on certain errors:

    ```ruby
    class DummyJob < Wayfarer::Base
      discard_on MyError do |job, error|
        # This block runs once and buries the job
      end
    end
    ```

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
wayfarer-0.4.5 docs/guides/error_handling.md
wayfarer-0.4.4 docs/guides/error_handling.md
wayfarer-0.4.3 docs/guides/error_handling.md
wayfarer-0.4.2 docs/guides/error_handling.md