Sunday, May 22, 2011

[Rails] Re: How to capture correctly a specific exception

Thanks Fred

I believe I can pass parameters to the Exception class for fine grain
processing
will read more about it .. any better link than Rials doc ,

On 22 mai, 19:06, Frederick Cheung <frederick.che...@gmail.com> wrote:
> On May 22, 4:36 pm, Erwin <yves_duf...@mac.com> wrote:
>
> > I a using delayed_job,  and I am raising an exception this way :
>
> > config/initializers/custom_exceptions.rb
> >    class RemoteLockerException < StandardError; end
> >    class RemoteLockerDenied < StandardError; end
>
> This should define just RemoteLockerDenied, not
> Exceptions::RemoteLockerDenied.
>
>
>
> > there is a hook for any exception raised, to trap ALL the errors
> > and do something according to the raised exception , i.e. :
>
> >     def error(job, exception)
> >       case exception
> >       when "RemoteContainerDenied"
> >         .. do something
> >       when "RemoteContainerException"
> >         .. do something else ......
> >       end
> >     end
>
> Your whens should use the exception class, not the name, ie
>
> when RemoteLockerDenied instead of when 'RemoteLockerDenied'
>
> Fred

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate