http://www.sinatrarb.com/intro.html#Error%20Handling ãã¡ããè¦ãã¨ä¾å¤ã¯Rackãªãã¸ã§ã¯ãã®sinatra.errorã«å ¥ã£ã¦ããã¨ãããããããã¯å¼æ°ã¨ãã¦ãåãåããã¨ãã§ããã (ãã¼ã¸ã§ã³1.4.4ã§ç¢ºèª) require "sinatra" # developmentã¢ã¼ãã§ããããã°è¡¨ç¤ºãããªã set :show_exceptions, false # ãããã¯å¼æ°ã§ä¾å¤ãªãã¸ã§ã¯ããåãåã error do |e| status 500 # ããã§ãã§ãããã© #body env['sinatra.error'].message # ããã§ããã body e.message end get "/hoge" do raise "hoge" end $ bundle exec ruby app.rb $ curl lo
Padrinoã§ã¨ã©ã¼ã®ãã³ããªã³ã°ãè¡ãã«ã¯ã以ä¸ã®ããã«æ¸ããã ãã©ãããã ãã ã¨ãã¡ã§ã class MyApp < Padrino::Application # ããããçç¥ # ãããªæãã§ã¨ã©ã¼å¦çãã«ã¹ã¿ãã¤ãº error do puts "ããã«ã¨ã©ã¼å¦çããã" end end 以ä¸ã®ãµã¤ãã«ããã¨ã Sinatra's error handler with custom exceptions does not work · Issue #403 · padrino/padrino-framework · GitHub 次ã®2è¡ã追å ããªãã¨ãå®è¡ãããªããããã class MyApp < Padrino::Application #ããããçç¥ # 以ä¸ã®2è¡ã追å disable :raise_errors disable :show_exceptions # ãã
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}