On Aug 14, 11:13 am, subv3 [email protected] wrote:
request.all { render :text => "Uh oh" }
end
end
and the same for #rescue_action_locally. It seems that if the Content-
Type header of the request is set to application/xml or application/
json then Rails ignores my exception rescuing code and goes back a
FAILSAFE 500 error. Anyone know why this is or what I’m doing wrong?
Thanks
What is the actual exception being raised? I’m having trouble
reproducing this:
class TotalController < ApplicationController
def blow_up
respond_to do |wants|
wants.json { render :json => make_ish }
wants.html { render :text => “hello” }
end
end
def rescue_action_locally(e)
render :text => “resuced”
end
private
def make_ish
raise “it up”
{:yo => :max!}
end
end
map.connect “die.:format”, :controller => “total”, :action =>
“blow_up”
xeno@amrita:~$ wget http://amrita/pixie/die.html
–2009-08-14 16:34:26-- http://amrita/pixie/die.html
Resolving amrita… 127.0.1.1
Connecting to amrita|127.0.1.1|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 6 [text/html]
Saving to: `die.html’
2009-08-14 16:34:26 (925 KB/s) - `die.html’ saved [6/6]
xeno@amrita:~$ cat die.html
hello
xeno@amrita:~$ wget http://amrita/pixie/die.json
–2009-08-14 16:34:34-- http://amrita/pixie/die.json
Resolving amrita… 127.0.1.1
Connecting to amrita|127.0.1.1|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 8 [application/json]
Saving to: `die.json’
2009-08-14 16:34:34 (913 KB/s) - `die.json’ saved [8/8]
xeno@amrita:~$ cat die.json
resuced
xeno@amrita:~$
As you can see, rescue_action_locally is being called, and the content-
type of the response is set to application/json. Or does it look there
theres something my setup is missing that yours has?