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
{{#tags}}- {{label}}
{{/tags}}