This should be `switch rec := rec.(type)`, and the error case below should be `message = rec.Error()`.