I’m trying to use a custom error page in Sinatra, but I’m getting this error:

NoMethodError: undefined method `bytesize' for [:name, ["Name is already taken"]]:Array

If I try to create a custom error like this:

error MyCustomError do
  'So what happened was...' + request.env['sinatra.error'].message
end

I get this page:

./regdel.rb:70: uninitialized constant MyCustomError (NameError)

Hmmmm.