k8s/io/kubernetes/pkg/api/errors.IsNotFound 示例代码

2022-03-03

以下示例是关于golang中包含errors.IsNotFound用法的示例代码,想了解errors.IsNotFound的具体用法?errors.IsNotFound怎么用?errors.IsNotFound使用的例子?那么可以参考以下10个相关示例代码来学习它的具体使用方法。

示例1:
service_test.go开发语言: Go项目名称: juju代码行数: 1756
772		err = rel.Refresh()
773		c.Assert(err, jc.Satisfies, errors.IsNotFound)
774	}
969	err = s.mysql.Refresh()
970	c.Assert(err, jc.Satisfies, errors.IsNotFound)
971}
1143	err = s.mysql.Refresh()
1144	c.Assert(err, jc.Satisfies, errors.IsNotFound)
1145}
1162	err = s.mysql.Refresh()
1163	c.Assert(err, jc.Satisfies, errors.IsNotFound)
1164}
1177	err = s.mysql.Refresh()
1178	c.Assert(err, jc.Satisfies, errors.IsNotFound)
1179}
示例2:
unit.go开发语言: Go项目名称: juju代码行数: 1946
192// AgentTools returns the tools that the agent is currently running.
193// It an error that satisfies errors.IsNotFound if the tools have not
194// yet been set.
292		if attempt > 0 {
293			if err := unit.Refresh(); errors.IsNotFound(err) {
294				return nil, jujutxn.ErrNoOperations
310	if err = unit.st.run(buildTxn); err == nil {
311		if err = unit.Refresh(); errors.IsNotFound(err) {
312			return nil
369	sdoc, err := getStatus(u.st, sdocId)
370	if errors.IsNotFound(err) {
371		return nil, errAlreadyDying
416	if err != nil {
417		if errors.IsNotFound(err) {
418			return nil, nil
示例3:
service_test.go开发语言: Go项目名称: juju代码行数: 1488
522		err = rel.Refresh()
523		c.Assert(err, jc.Satisfies, errors.IsNotFound)
524	}
719	err = s.mysql.Refresh()
720	c.Assert(err, jc.Satisfies, errors.IsNotFound)
721}
913	err = s.mysql.Refresh()
914	c.Assert(err, jc.Satisfies, errors.IsNotFound)
915}
932	err = s.mysql.Refresh()
933	c.Assert(err, jc.Satisfies, errors.IsNotFound)
934}
947	err = s.mysql.Refresh()
948	c.Assert(err, jc.Satisfies, errors.IsNotFound)
949}
示例4:
unit_test.go开发语言: Go项目名称: juju代码行数: 1763
48	c.Assert(err, gc.ErrorMatches, `unit "subway/0" not found`)
49	c.Assert(err, jc.Satisfies, errors.IsNotFound)
50}
525	err = unit1.Refresh()
526	c.Assert(err, jc.Satisfies, errors.IsNotFound)
527}
944	err := entity.Refresh()
945	c.Assert(err, jc.Satisfies, errors.IsNotFound)
946	err = entity.Destroy()
1220	err = s.unit.Refresh()
1221	c.Assert(err, jc.Satisfies, errors.IsNotFound)
1222
1265	err = s.unit.Refresh()
1266	c.Assert(err, jc.Satisfies, errors.IsNotFound)
1267
示例5:
state_test.go开发语言: Go项目名称: juju代码行数: 3493
146	err2 := errors.NotFoundf("foo")
147	c.Assert(err1, gc.Not(jc.Satisfies), errors.IsNotFound)
148	c.Assert(err2, jc.Satisfies, errors.IsNotFound)
208	_, err = s.State.LatestPlaceholderCharm(curl)
209	c.Assert(err, jc.Satisfies, errors.IsNotFound)
210}
228	_, err = s.State.Charm(curl)
229	c.Assert(err, jc.Satisfies, errors.IsNotFound)
230}
340	sch, err = s.State.UpdateUploadedCharm(ch, missingCurl, bundleURL, "missing")
341	c.Assert(err, jc.Satisfies, errors.IsNotFound)
342	c.Assert(sch, gc.IsNil)
374	_, err = s.State.Charm(curl)
375	c.Assert(err, jc.Satisfies, errors.IsNotFound)
376}
示例6:
cleanup.go开发语言: Go项目名称: juju代码行数: 365
187	unit, err := st.Unit(name)
188	if errors.IsNotFound(err) {
189		return nil
198		relationUnit, err := relation.Unit(unit)
199		if errors.IsNotFound(err) {
200			continue
232	machine, err := st.Machine(machineId)
233	if errors.IsNotFound(err) {
234		return nil
253	// above, and may thus fail immediately.
254	if err := machine.Refresh(); errors.IsNotFound(err) {
255		return nil
282	containerIds, err := machine.Containers()
283	if errors.IsNotFound(err) {
284		return nil
示例7:
image_test.go开发语言: Go项目名称: juju代码行数: 491
117	_, _, err := s.storage.Image("lxc", "trusty", "amd64")
118	c.Assert(err, jc.Satisfies, errors.IsNotFound)
119	c.Assert(err, gc.ErrorMatches, `.* image metadata not found`)
122	_, _, err = s.storage.Image("lxc", "trusty", "amd64")
123	c.Assert(err, jc.Satisfies, errors.IsNotFound)
124	c.Assert(err, gc.ErrorMatches, `resource at path "environs/my-uuid/path" not found`)
169	_, _, err = managedStorage.GetForEnvironment("my-uuid", "path")
170	c.Assert(err, jc.Satisfies, errors.IsNotFound)
171
232	_, _, err = managedStorage.GetForEnvironment("my-uuid", path)
233	c.Assert(err, jc.Satisfies, errors.IsNotFound)
234}
312	_, _, err = managedStorage.GetForEnvironment("my-uuid", "images/lxc-trusty-amd64:0")
313	c.Assert(err, jc.Satisfies, errors.IsNotFound)
314
示例8:
simplestreams.go开发语言: Go项目名称: juju代码行数: 1021
413	)
414	if errors.IsNotFound(err) || errors.IsUnauthorized(err) {
415		logger.Debugf("%s not found, trying legacy index file", indexPath)
422	if err != nil {
423		if errors.IsNotFound(err) || errors.IsUnauthorized(err) {
424			logger.Debugf("cannot load index %q: %v", indexURL, err)
430	if err != nil {
431		if errors.IsNotFound(err) {
432			logger.Debugf("skipping index because of error getting latest metadata %q: %v", indexURL, err)
486	if err != nil {
487		if errors.IsNotFound(err) || errors.IsUnauthorized(err) {
488			return nil, err
503	mirrors, url, err := getMirrorRefs(source, mirrorsPath, requireSigned, params)
504	if err != nil && !errors.IsNotFound(err) && !errors.IsUnauthorized(err) {
505		return nil, fmt.Errorf("cannot load mirror metadata at URL %q: %v", url, err)
示例9:
machine_test.go开发语言: Go项目名称: juju代码行数: 2275
327	c.Assert(ports, gc.IsNil)
328	c.Assert(err, jc.Satisfies, errors.IsNotFound)
329}
373	err = s.machine.Refresh()
374	c.Assert(err, jc.Satisfies, errors.IsNotFound)
375	_, err = s.machine.HardwareCharacteristics()
376	c.Assert(err, jc.Satisfies, errors.IsNotFound)
377	_, err = s.machine.Containers()
378	c.Assert(err, jc.Satisfies, errors.IsNotFound)
379	networks, err := s.machine.RequestedNetworks()
761		if strings.Contains(test.expectErr, "not found") {
762			c.Check(err, jc.Satisfies, errors.IsNotFound)
763		}
示例10:
cleanup.go开发语言: Go项目名称: juju代码行数: 304
163	unit, err := st.Unit(name)
164	if errors.IsNotFound(err) {
165		return nil
174		relationUnit, err := relation.Unit(unit)
175		if errors.IsNotFound(err) {
176			continue
206	machine, err := st.Machine(machineId)
207	if errors.IsNotFound(err) {
208		return nil
227	// above, and may thus fail immediately.
228	if err := machine.Refresh(); errors.IsNotFound(err) {
229		return nil
249	containerIds, err := machine.Containers()
250	if errors.IsNotFound(err) {
251		return nil

本文地址:https://www.itbaoku.cn/snippets/415696.html