added ctx to datastore and improve mock (#329)

Added ctx to datastore and improved mock
This commit is contained in:
Pedro Nasser
2016-11-22 03:33:44 -02:00
committed by GitHub
parent 5e61d2b055
commit c14bc323f9
23 changed files with 292 additions and 229 deletions

View File

@@ -14,15 +14,13 @@ func handleAppGet(c *gin.Context) {
log := common.Logger(ctx)
appName := c.Param("app")
app, err := Api.Datastore.GetApp(appName)
app, err := Api.Datastore.GetApp(ctx, appName)
if err != nil {
if err != nil && err != models.ErrAppsNotFound {
log.WithError(err).Error(models.ErrAppsGet)
c.JSON(http.StatusInternalServerError, simpleError(models.ErrAppsGet))
return
}
if app == nil {
} else if app == nil {
log.WithError(err).Error(models.ErrAppsNotFound)
c.JSON(http.StatusNotFound, simpleError(models.ErrAppsNotFound))
return