Properly handle status code assignment for ActiveRecord::RecordNotFound and Sinatra::NotFound errors