I was under the impression that if I edit the 500.html page in the public folder it will replace the: "Application error (Rails)" message. But the message in the 500.html file reads: "Application error (Apache)" I can''t seem to find the error message anywhere within any of the pages that make up my project. Is there an easy way to replace the "Application error (Rails)" page? Thanks for your insight. John
I think you''re looking for <railsdir>/public/.htaccess ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly" Jason On 6/30/05, John Kopanas <john.kopanas-O1KSuMybMhqBUy7/sJONFg@public.gmane.org> wrote:> I was under the impression that if I edit the 500.html page in the > public folder it will replace the: > > "Application error (Rails)" > > message. > > But the message in the 500.html file reads: > > "Application error (Apache)" > > I can''t seem to find the error message anywhere within any of the > pages that make up my project. Is there an easy way to replace the > "Application error (Rails)" page? > > Thanks for your insight. > > John > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
I don''t have an .htaccess fil in my public folder. So I still have no clue where that error message is coming from or how to easily specify to just use my 500.html file or something. On 30-Jun-05, at 12:36 PM, Jason Foreman wrote:> I think you''re looking for <railsdir>/public/.htaccess > > ErrorDocument 500 "<h2>Application error</h2>Rails application failed > to start properly" > > > Jason > > > On 6/30/05, John Kopanas <john.kopanas-O1KSuMybMhqBUy7/sJONFg@public.gmane.org> wrote: > >> I was under the impression that if I edit the 500.html page in the >> public folder it will replace the: >> >> "Application error (Rails)" >> >> message. >> >> But the message in the 500.html file reads: >> >> "Application error (Apache)" >> >> I can''t seem to find the error message anywhere within any of the >> pages that make up my project. Is there an easy way to replace the >> "Application error (Rails)" page? >> >> Thanks for your insight. >> >> John >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> >> > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >John Kopanas http://www.thedatingguy.com - Online Dating the way it should be. http://blog.thedatingguy.com
That "Application error (Rails)" message comes from the file actionpack/lib/action_controller/rescue.rb (line 55): def rescue_action_in_public(exception) #:doc: case exception when RoutingError, UnknownAction then render_text(IO.read(File.join(RAILS_ROOT, ''public'', ''404.html'')), "404 Not Found") else render_text "<html><body><h1>Application error (Rails)</h1></body></html>" end end You''ll obviously note that it does reference 404.html but doesn''t get the 500.html file from /public. In the intereim while this is the way it is, I added my own rescue.rb to /lib and required it in environment.rb - it looks like this: module ActionController module Rescue protected # Overwrite to implement public exception handling (for requests answering false to <tt>local_request?</tt>). def rescue_action_in_public(exception) #:doc: case exception when RoutingError, UnknownAction then render_text(IO.read(File.join(RAILS_ROOT, ''public'', ''404.html'')), "404 Not Found") else render_text(IO.read(File.join(RAILS_ROOT, ''public'', ''500.html'')), "<html><body><h1>Application error (Rails)</h1></body></html>") end end end end Before anyone asks, yes I was going to submit this as a patch but I couldn''t get the rails tests to run before submitting it, so I decided to leave it until I could :) Hope that helps, Dan On 7/1/05, John Kopanas <john.kopanas-O1KSuMybMhqBUy7/sJONFg@public.gmane.org> wrote:> I don''t have an .htaccess fil in my public folder. So I still have > no clue where that error message is coming from or how to easily > specify to just use my 500.html file or something. > > On 30-Jun-05, at 12:36 PM, Jason Foreman wrote: > > > I think you''re looking for <railsdir>/public/.htaccess > > > > ErrorDocument 500 "<h2>Application error</h2>Rails application failed > > to start properly" > > > > > > Jason > > > > > > On 6/30/05, John Kopanas <john.kopanas-O1KSuMybMhqBUy7/sJONFg@public.gmane.org> wrote: > > > >> I was under the impression that if I edit the 500.html page in the > >> public folder it will replace the: > >> > >> "Application error (Rails)" > >> > >> message. > >> > >> But the message in the 500.html file reads: > >> > >> "Application error (Apache)" > >> > >> I can''t seem to find the error message anywhere within any of the > >> pages that make up my project. Is there an easy way to replace the > >> "Application error (Rails)" page? > >> > >> Thanks for your insight. > >> > >> John > >> _______________________________________________ > >> Rails mailing list > >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > >> http://lists.rubyonrails.org/mailman/listinfo/rails > >> > >> > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > John Kopanas > http://www.thedatingguy.com - Online Dating the way it should be. > http://blog.thedatingguy.com > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Thanks... it worked perfectly! :-) On 30-Jun-05, at 8:13 PM, Dan Sketcher wrote:> That "Application error (Rails)" message comes from the file > actionpack/lib/action_controller/rescue.rb (line 55): > > def rescue_action_in_public(exception) #:doc: > case exception > when RoutingError, UnknownAction then > render_text(IO.read(File.join(RAILS_ROOT, ''public'', > ''404.html'')), "404 Not Found") > else render_text "<html><body><h1>Application error > (Rails)</h1></body></html>" > end > end > > You''ll obviously note that it does reference 404.html but doesn''t get > the 500.html file from /public. In the intereim while this is the way > it is, I added my own rescue.rb to /lib and required it in > environment.rb - it looks like this: > > module ActionController > module Rescue > protected > # Overwrite to implement public exception handling (for requests > answering false to <tt>local_request?</tt>). > def rescue_action_in_public(exception) #:doc: > case exception > when RoutingError, UnknownAction then > render_text(IO.read(File.join(RAILS_ROOT, ''public'', > ''404.html'')), "404 Not Found") > else > render_text(IO.read(File.join(RAILS_ROOT, ''public'', > ''500.html'')), > "<html><body><h1>Application error (Rails)</h1></ > body></html>") > end > end > end > end > > Before anyone asks, yes I was going to submit this as a patch but I > couldn''t get the rails tests to run before submitting it, so I decided > to leave it until I could :) > > Hope that helps, > > Dan > > On 7/1/05, John Kopanas <john.kopanas-O1KSuMybMhqBUy7/sJONFg@public.gmane.org> wrote: > >> I don''t have an .htaccess fil in my public folder. So I still have >> no clue where that error message is coming from or how to easily >> specify to just use my 500.html file or something. >> >> On 30-Jun-05, at 12:36 PM, Jason Foreman wrote: >> >> >>> I think you''re looking for <railsdir>/public/.htaccess >>> >>> ErrorDocument 500 "<h2>Application error</h2>Rails application >>> failed >>> to start properly" >>> >>> >>> Jason >>> >>> >>> On 6/30/05, John Kopanas <john.kopanas-O1KSuMybMhqBUy7/sJONFg@public.gmane.org> wrote: >>> >>> >>>> I was under the impression that if I edit the 500.html page in the >>>> public folder it will replace the: >>>> >>>> "Application error (Rails)" >>>> >>>> message. >>>> >>>> But the message in the 500.html file reads: >>>> >>>> "Application error (Apache)" >>>> >>>> I can''t seem to find the error message anywhere within any of the >>>> pages that make up my project. Is there an easy way to replace the >>>> "Application error (Rails)" page? >>>> >>>> Thanks for your insight. >>>> >>>> John >>>> _______________________________________________ >>>> Rails mailing list >>>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>>> http://lists.rubyonrails.org/mailman/listinfo/rails >>>> >>>> >>>> >>> _______________________________________________ >>> Rails mailing list >>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >>> http://lists.rubyonrails.org/mailman/listinfo/rails >>> >>> >> >> >> John Kopanas >> http://www.thedatingguy.com - Online Dating the way it should be. >> http://blog.thedatingguy.com >> >> >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> >> > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >John Kopanas http://www.thedatingguy.com - Online Dating the way it should be. http://blog.thedatingguy.com
On Jul 1, 2005, at 11:11 AM, John Kopanas wrote:> Thanks... it worked perfectly! :-) > > On 30-Jun-05, at 8:13 PM, Dan Sketcher wrote: > >> That "Application error (Rails)" message comes from the file >> actionpack/lib/action_controller/rescue.rb (line 55): >> >> def rescue_action_in_public(exception) #:doc: >> case exception >> when RoutingError, UnknownAction then >> render_text(IO.read(File.join(RAILS_ROOT, ''public'', >> ''404.html'')), "404 Not Found") >> else render_text "<html><body><h1>Application error >> (Rails)</h1></body></html>" >> end >> end >> >> You''ll obviously note that it does reference 404.html but doesn''t get >> the 500.html file from /public. In the intereim while this is the way >> it is, I added my own rescue.rb to /lib and required it in >> environment.rb - it looks like this: >> >> module ActionController >> module Rescue >> protected >> # Overwrite to implement public exception handling (for requests >> answering false to <tt>local_request?</tt>). >> def rescue_action_in_public(exception) #:doc: >> case exception >> when RoutingError, UnknownAction then >> render_text(IO.read(File.join(RAILS_ROOT, ''public'', >> ''404.html'')), "404 Not Found") >> else >> render_text(IO.read(File.join(RAILS_ROOT, ''public'', >> ''500.html'')), >> "<html><body><h1>Application error >> (Rails)</h1></body></html>") >> end >> end >> end >> end >>The second argument to render_text is status (http://api.rubyonrails.com/classes/ActionController/ Base.html#M000162), so I think it should be something more like "500 Server Error". I was having problems with how the above code rendered in Safari... Aside from that, it seems to be working great. I can finally stop getting calls from my boss about the "rails error"... :)
Ah, good pickup. I was just trying to keep it as small a change as possible :) On 7/2/05, Zach Thompson <zach-DZILUfagCPWukZHgTAicrQ@public.gmane.org> wrote:> On Jul 1, 2005, at 11:11 AM, John Kopanas wrote: > > > Thanks... it worked perfectly! :-) > > > > On 30-Jun-05, at 8:13 PM, Dan Sketcher wrote: > > > >> That "Application error (Rails)" message comes from the file > >> actionpack/lib/action_controller/rescue.rb (line 55): > >> > >> def rescue_action_in_public(exception) #:doc: > >> case exception > >> when RoutingError, UnknownAction then > >> render_text(IO.read(File.join(RAILS_ROOT, ''public'', > >> ''404.html'')), "404 Not Found") > >> else render_text "<html><body><h1>Application error > >> (Rails)</h1></body></html>" > >> end > >> end > >> > >> You''ll obviously note that it does reference 404.html but doesn''t get > >> the 500.html file from /public. In the intereim while this is the way > >> it is, I added my own rescue.rb to /lib and required it in > >> environment.rb - it looks like this: > >> > >> module ActionController > >> module Rescue > >> protected > >> # Overwrite to implement public exception handling (for requests > >> answering false to <tt>local_request?</tt>). > >> def rescue_action_in_public(exception) #:doc: > >> case exception > >> when RoutingError, UnknownAction then > >> render_text(IO.read(File.join(RAILS_ROOT, ''public'', > >> ''404.html'')), "404 Not Found") > >> else > >> render_text(IO.read(File.join(RAILS_ROOT, ''public'', > >> ''500.html'')), > >> "<html><body><h1>Application error > >> (Rails)</h1></body></html>") > >> end > >> end > >> end > >> end > >> > > The second argument to render_text is status > (http://api.rubyonrails.com/classes/ActionController/ > Base.html#M000162), so I think it should be something more like "500 > Server Error". I was having problems with how the above code rendered > in Safari... > > Aside from that, it seems to be working great. I can finally stop > getting calls from my boss about the "rails error"... :) > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >