You can use rescue_from instead of discard_on:

https://api.rubyonrails.org/classes/ActiveSupport/Rescuable/ClassMethods.html

On Thu, May 2, 2019 at 8:44 AM Duka <dukayg...@gmail.com> wrote:

> Hello,
>
> I have seem Rails Guides about feature request and Im posting this
> idea/issue here, in case of someone is disposal to implement it, or if
> people enough think is a good idea maybe I can do, is a simple problem but
> seems to not have a ready-solution.
>
> Basically, in the active job we have the `discard_on` method, which
> accepts a error type or a block(created to report the error somewhere else).
>
> My issue is that I have 2 different errors that are the same type, but the
> error arguments and message are different, the error is
> ActiveResource::ClientError, I want basically discard this error when
> status is 400, and not discard when status is 403.
>
> I did not found any solution for that, someone has any idea of how solve
> this? The block of discard_on did not seems to return an true/false, that
> would be the ideal solution, if return true then it is discarded, if
> returns false, not discard.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rubyonrails-core+unsubscr...@googlegroups.com.
> To post to this group, send email to rubyonrails-core@googlegroups.com.
> Visit this group at https://groups.google.com/group/rubyonrails-core.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-core+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-core@googlegroups.com.
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to