Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby and Sinatra

Tags:

ruby

sinatra

I started writing a simple Sinatra app today and I am trying to understand the error reporting but for some reason I can't get it to work correctly.

I know here, http://railsapi.com/doc/sinatra-v1.0/, it talks about working with error reporting/handling but when I run their examples I can't get it to work.

require 'sinatra'

error 400..510 do
  'Boom'
end

get '/say/*' do
  params[:splat]
end

When I run the app on my computer I get a 404 error code, but the 'Boom' text does not display in the browser, just the browser 404 page. I am sure I am doing something wrong, but just can't figure it out.

like image 884
dennismonsewicz Avatar asked Sep 15 '26 22:09

dennismonsewicz


1 Answers

I will wager its your browser. On my MacBook Pro:

Chrome "helpfully" displays a "Oops! This link appears to be broken." page.

Safari displays the expected Boom text.

Firefox displays the expected Boom text.

like image 153
cfeduke Avatar answered Sep 18 '26 10:09

cfeduke