I''m getting ready to deploy a production app based on Camping, but
have one little thing I want to iron out.
Is it possible to override the ServerError class? I need custom 500''s
to come up, and not the normal "Camping Problem!" page.
I am trying to override, just like I do the NotFound class, but can''t
seem to get it to take. I just get a blank page back (with errors to
the console) when I do this:
module MyApp::Controllers
class ServerError
def get(k,m,e)
@status = 500
div do
h1 ''Wow! You Broke Me!''
h2 "in #{k}.#{m}"
h3 "#{e.class} #{e.message}:"
ul do
e.backtrace.each do |bt|
li bt
end
end
end
end
end
end
Any ideas? Am I just missing something super obvious?
Thanks all,
Michael
Never mind, guys. I missed it in the archives, but found it via google: http://rubyforge.org/pipermail/camping-list/2006-July/000063.html I am doing things right, I just need to render a template instead of output everything in the controller. Sorry! On 1/9/07, Michael Gorsuch <michael.gorsuch at gmail.com> wrote:> I''m getting ready to deploy a production app based on Camping, but > have one little thing I want to iron out. > > Is it possible to override the ServerError class? I need custom 500''s > to come up, and not the normal "Camping Problem!" page. > > I am trying to override, just like I do the NotFound class, but can''t > seem to get it to take. I just get a blank page back (with errors to > the console) when I do this: > > module MyApp::Controllers > class ServerError > def get(k,m,e) > @status = 500 > div do > h1 ''Wow! You Broke Me!'' > h2 "in #{k}.#{m}" > h3 "#{e.class} #{e.message}:" > ul do > e.backtrace.each do |bt| > li bt > end > end > end > end > end > end > > Any ideas? Am I just missing something super obvious? > > Thanks all, > > Michael >
On Tue, Jan 09, 2007 at 02:20:43PM -0500, Michael Gorsuch wrote:> Is it possible to override the ServerError class? I need custom 500''s > to come up, and not the normal "Camping Problem!" page.Are you on FastCGI? Because FastCGI has its own error page (which is broken in many gems.) The FastCGI error page kicks in when an error is caused outside of the scope of Camping, so it sort of depends on what the nature of the exception is. For instance, a parse error will toss to FastCGI''s error and a database problem will likely hit Camping''s. See the server_error method[1] for that. You might temporarily try out Camping from SVN, to at least get that method fixed so you can see the underlying error. _why [1] http://code.whytheluckystiff.net/camping/browser/trunk/lib/camping/fastcgi.rb
On Tue, Jan 09, 2007 at 02:28:17PM -0500, Michael Gorsuch wrote:> I am doing things right, I just need to render a template instead of > output everything in the controller.Curious. It should let ya. Can you pass on the software versions you''re using and i''ll ticketize. _why
Sure. I''ve narrowed it down to a code sample that sort of works, and
one that doesn''t.
ruby version: ruby 1.8.5 (2006-09-06) [i386-netbsdelf]
camping gem: 1.5.180
mongrel (just in case): 0.3.13.4
My App name is ''Dreaming''.
This code sample will at least send ''test'' to the browser:
module Dreaming::Controllers
class ServerError
def get(k,m,e)
@status = 500
''test''
end
end
end
This one will not send anything to the browser:
module Dreaming::Controllers
class ServerError
def get(k,m,e)
@status = 500
div do
p "test"
end
end
end
end
Thanks. I''ll keep digging myself to see if I can come up with
anything.
On 1/9/07, why the lucky stiff <why at whytheluckystiff.net>
wrote:> On Tue, Jan 09, 2007 at 02:28:17PM -0500, Michael Gorsuch wrote:
> > I am doing things right, I just need to render a template instead of
> > output everything in the controller.
>
> Curious. It should let ya. Can you pass on the software versions
> you''re using and i''ll ticketize.
>
> _why
> _______________________________________________
> Camping-list mailing list
> Camping-list at rubyforge.org
> http://rubyforge.org/mailman/listinfo/camping-list
>