Merge pull request #234 from tamird/cockroach

api: properly check for errors
This commit is contained in:
Dan Sosedoff
2017-04-30 11:25:39 -05:00
committed by GitHub
+2 -2
View File
@@ -109,12 +109,12 @@ func Connect(c *gin.Context) {
info, err := cl.Info()
if err == nil {
err = setClient(c, cl)
}
if err != nil {
cl.Close()
c.JSON(400, Error{err.Error()})
return
}
}
c.JSON(200, info.Format()[0])
}
@@ -163,12 +163,12 @@ func SwitchDb(c *gin.Context) {
info, err := cl.Info()
if err == nil {
err = setClient(c, cl)
}
if err != nil {
cl.Close()
c.JSON(400, Error{err.Error()})
return
}
}
conn.Close()