[Nitro] Redirecting to error action/method

Lars Olsson lasso at lassoweb.se
Wed Dec 6 14:42:46 EST 2006


Hi!

I actually use it in two kinds of situations:

1. Custom error handler

def error
     error, path = @context.rendering_errors[0]
     if error.kind_of?(Nitro::ActionError)
         # Tell user page doesn't exist
     else
         # Tell user an internal error occurred
         # Additional actions (logging etc)
     end
end

2. A simple way to "hide" pages from unauthorized users

def some_action
     if some_condition
         # Allow user to see page
     else
         raise Nitro::ActionError.new
     end
end


Kindly

/lasso


Jonathan Buch skrev:
> Hi,
> 
>> Thanks Jonathan! It was actually a coding error on my part that caused
>> the strange effect I saw.
>>
>> <mad ramblings aimed_at="no_one_in_particular">
>> WHY WHY WHY is Nitro::NoActionError renamed to Nitro::ActionError
>> WITHOUT A BIG SIGN declaring the change in the release notes??? Now I
>> hade to go through the darcs changelog to find out...Important API
>> changes need to be documented better!!!
>> </mad ramblings>
> 
> Ayyy... I feel partly responsible for that I guess.  ^^;
> 
> But actually neither George nor I had forseen this internal error be
> used outside of dispatcher.rb and render.rb I guess....
> 
> Jo


More information about the Nitro-general mailing list