• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang errors.NewNotFoundError函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/backstage/maestro/errors.NewNotFoundError函数的典型用法代码示例。如果您正苦于以下问题:Golang NewNotFoundError函数的具体用法?Golang NewNotFoundError怎么用?Golang NewNotFoundError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了NewNotFoundError函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: FindPluginByNameAndService

func (m *Mem) FindPluginByNameAndService(pluginName string, service account.Service) (account.Plugin, error) {
	if plugin, ok := m.Plugins[service.Subdomain][pluginName]; !ok {
		return account.Plugin{}, errors.NewNotFoundError(errors.ErrPluginNotFound)
	} else {
		return plugin, nil
	}
}
开发者ID:yonglehou,项目名称:maestro,代码行数:7,代码来源:mem.go


示例2: FindHookByName

func (m *Mem) FindHookByName(name string) (account.Hook, error) {
	if hook, ok := m.Hooks[name]; !ok {
		return account.Hook{}, errors.NewNotFoundError(errors.ErrHookNotFound)
	} else {
		return hook, nil
	}
}
开发者ID:yonglehou,项目名称:maestro,代码行数:7,代码来源:mem.go


示例3: FindUserByEmail

func (m *Mem) FindUserByEmail(email string) (account.User, error) {
	if user, ok := m.Users[email]; !ok {
		return account.User{}, errors.NewNotFoundError(errors.ErrUserNotFound)
	} else {
		return user, nil
	}
}
开发者ID:yonglehou,项目名称:maestro,代码行数:7,代码来源:mem.go


示例4: FindTeamByAlias

func (m *Mem) FindTeamByAlias(alias string) (account.Team, error) {
	if team, ok := m.Teams[alias]; !ok {
		return account.Team{}, errors.NewNotFoundError(errors.ErrTeamNotFound)
	} else {
		return team, nil
	}
}
开发者ID:yonglehou,项目名称:maestro,代码行数:7,代码来源:mem.go


示例5: FindAppByClientId

func (m *Mem) FindAppByClientId(id string) (account.App, error) {
	if app, ok := m.Apps[id]; !ok {
		return account.App{}, errors.NewNotFoundError(errors.ErrAppNotFound)
	} else {
		return app, nil
	}
}
开发者ID:yonglehou,项目名称:maestro,代码行数:7,代码来源:mem.go


示例6: FindServiceBySubdomain

func (m *Mem) FindServiceBySubdomain(subdomain string) (account.Service, error) {
	if service, ok := m.Services[subdomain]; !ok {
		return account.Service{}, errors.NewNotFoundError(errors.ErrServiceNotFound)
	} else {
		return service, nil
	}
}
开发者ID:yonglehou,项目名称:maestro,代码行数:7,代码来源:mem.go


示例7: ChangePassword

// Updates the password for an existing account.
func (user *User) ChangePassword() error {
	if !user.Exists() {
		return errors.NewNotFoundError(errors.ErrUserNotFound)
	}

	user.hashPassword()
	return store.UpsertUser(*user)
}
开发者ID:yonglehou,项目名称:maestro,代码行数:9,代码来源:user.go


示例8: DeleteService

func (m *Mem) DeleteService(s account.Service) error {
	if _, ok := m.Services[s.Subdomain]; !ok {
		return errors.NewNotFoundError(errors.ErrServiceNotFound)
	}

	delete(m.Services, s.Subdomain)
	return nil
}
开发者ID:yonglehou,项目名称:maestro,代码行数:8,代码来源:mem.go


示例9: DeletePluginsByService

func (m *Mem) DeletePluginsByService(service account.Service) error {
	if _, ok := m.Plugins[service.Subdomain]; !ok {
		return errors.NewNotFoundError(errors.ErrPluginNotFound)
	}

	delete(m.Plugins, service.Subdomain)
	return nil
}
开发者ID:yonglehou,项目名称:maestro,代码行数:8,代码来源:mem.go


示例10: DeleteUser

func (m *Mem) DeleteUser(u account.User) error {
	if _, ok := m.Users[u.Email]; !ok {
		return errors.NewNotFoundError(errors.ErrUserNotFound)
	}

	delete(m.Users, u.Email)
	return nil
}
开发者ID:yonglehou,项目名称:maestro,代码行数:8,代码来源:mem.go


示例11: DeleteHook

func (m *Mem) DeleteHook(w account.Hook) error {
	if _, ok := m.Hooks[w.Name]; !ok {
		return errors.NewNotFoundError(errors.ErrHookNotFound)
	}

	delete(m.Hooks, w.Name)
	return nil
}
开发者ID:yonglehou,项目名称:maestro,代码行数:8,代码来源:mem.go


示例12: DeleteTeam

func (m *Mem) DeleteTeam(t account.Team) error {
	if _, ok := m.Teams[t.Alias]; !ok {
		return errors.NewNotFoundError(errors.ErrTeamNotFound)
	}

	delete(m.Teams, t.Alias)
	return nil
}
开发者ID:yonglehou,项目名称:maestro,代码行数:8,代码来源:mem.go


示例13: DeleteApp

func (m *Mem) DeleteApp(a account.App) error {
	if _, ok := m.Apps[a.ClientId]; !ok {
		return errors.NewNotFoundError(errors.ErrAppNotFound)
	}

	delete(m.Apps, a.ClientId)
	return nil
}
开发者ID:yonglehou,项目名称:maestro,代码行数:8,代码来源:mem.go


示例14: DeletePlugin

func (m *Mem) DeletePlugin(pc account.Plugin) error {
	if _, ok := m.Plugins[pc.Service][pc.Name]; !ok {
		return errors.NewNotFoundError(errors.ErrPluginNotFound)
	}

	delete(m.Plugins, pc.Name)
	return nil
}
开发者ID:yonglehou,项目名称:maestro,代码行数:8,代码来源:mem.go


示例15: DeleteHooksByTeam

func (m *Mem) DeleteHooksByTeam(team account.Team) error {
	found := false
	for _, wh := range m.Hooks {
		if wh.Team == team.Alias {
			delete(m.Hooks, wh.Name)
			found = true
		}
	}
	if !found {
		return errors.NewNotFoundError(errors.ErrTeamNotFound)
	}
	return nil
}
开发者ID:yonglehou,项目名称:maestro,代码行数:13,代码来源:mem.go


示例16: handleError

func handleError(err error) error {
	switch erro := err.(type) {
	case *etcd.EtcdError:
		if erro.ErrorCode == 100 {
			return errors.NewNotFoundError(erro)
		}

		if erro.ErrorCode == 105 {
			return errors.NewDuplicateEntryError(erro)
		}
	}

	return err
}
开发者ID:yonglehou,项目名称:maestro,代码行数:14,代码来源:etcd.go


示例17: Update

func (app *App) Update() error {
	if err := app.valid(); err != nil {
		Logger.Info("Failed to create an app with invalid data: %+v.", app)
		return err
	}

	if !app.Exists() {
		Logger.Info("Failed to update a not-found app: %+v.", app)
		return errors.NewNotFoundError(errors.ErrAppNotFound)
	}

	err := store.UpsertApp(*app)
	Logger.Info("app.Update: %+v. Err: %s.", app, err)
	return err
}
开发者ID:yonglehou,项目名称:maestro,代码行数:15,代码来源:app.go


示例18: DeleteHooksByTeam

func (m *Mongore) DeleteHooksByTeam(team account.Team) error {
	var strg Storage
	strg.Storage = m.openSession()
	defer strg.Close()

	err := strg.Hooks().Remove(bson.M{"team": team.Alias})

	if err == mgo.ErrNotFound {
		return errors.NewNotFoundError(errors.ErrHookNotFound)
	}
	if err != nil {
		Logger.Warn(err.Error())
	}

	return err
}
开发者ID:yonglehou,项目名称:maestro,代码行数:16,代码来源:mongore.go


示例19: DeleteTeam

func (m *Mongore) DeleteTeam(t account.Team) error {
	var strg Storage
	strg.Storage = m.openSession()
	defer strg.Close()

	err := strg.Teams().Remove(t)

	if err == mgo.ErrNotFound {
		return errors.NewNotFoundError(errors.ErrTeamNotFound)
	}
	if err != nil {
		Logger.Warn(err.Error())
	}

	return err
}
开发者ID:yonglehou,项目名称:maestro,代码行数:16,代码来源:mongore.go


示例20: DeleteService

func (m *Mongore) DeleteService(s account.Service) error {
	var strg Storage
	strg.Storage = m.openSession()
	defer strg.Close()

	err := strg.Services().Remove(s)

	if err == mgo.ErrNotFound {
		return errors.NewNotFoundError(errors.ErrServiceNotFound)
	}
	if err != nil {
		Logger.Warn(err.Error())
	}

	return err
}
开发者ID:yonglehou,项目名称:maestro,代码行数:16,代码来源:mongore.go



注:本文中的github.com/backstage/maestro/errors.NewNotFoundError函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang db.LazyTrx类代码示例发布时间:2022-05-24
下一篇:
Golang account.User类代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap