module RestBase
  class Application < Sinatra::Base
    not_found do
      response.body = 'Endpoint not found'
    end

    error 401 do
      response.body = 'Unauthorized Access'
      create_response()
    end
    
    error 404 do
      response.body = "Endpoint not found"
      create_response()
    end

    error 500 do
      return @env['sinatra.error'].message unless @env['sinatra.error'].nil?
      response.body = 'Internal Error'
      create_response()
    end
  end
end