【发布时间】:2015-04-24 11:51:42
【问题描述】:
我在 Google App engine Go Runtime 上使用 Redis Cloud 服务(来自 Redis Labs),当我尝试获取不存在的密钥时出现上述错误。该代码在本地测试服务器上运行良好,但在生产中出现恐慌。
c, err := redis.Dial("tcp", "pub-redis-myredis:<myport>")
_, err = c.Do("AUTH", "password")
value, err := c.Do("GET", "foo4")
if value == nil {
log.Infof(contextOfAppEngineWhereServerIsRunning, "value not found in redislabs")
}
日志显示panic在_, err = c.Do("AUTH", "password")这一行
【问题讨论】:
-
检查每个返回的
error。目前在您发布的代码中,您没有检查。
标签: google-app-engine go redislabs