以下示例是关于golang中包含errors.IsAlreadyExists用法的示例代码,想了解errors.IsAlreadyExists的具体用法?errors.IsAlreadyExists怎么用?errors.IsAlreadyExists使用的例子?那么可以参考以下10个相关示例代码来学习它的具体使用方法。
254 })
255 if !errors.IsAlreadyExists(err) {
256 t.Errorf("Unexpected error returned: %#v", err)
288 err = registry.ApplyBinding(ctx, &api.Binding{PodID: "foo", Host: "machine"})
289 if !errors.IsAlreadyExists(err) {
290 t.Fatalf("Unexpected error returned: %#v", err)
938 })
939 if !errors.IsAlreadyExists(err) {
940 t.Errorf("expected already exists err, got %#v", err)
1033 })
1034 if !errors.IsAlreadyExists(err) {
1035 t.Errorf("expected already exists err, got %#v", err)
916 _, err := m.st.AddNetwork(network)
917 if err != nil && errors.IsAlreadyExists(err) {
918 // Ignore already existing networks.
925 _, err := m.AddNetworkInterface(iface)
926 if err != nil && errors.IsAlreadyExists(err) {
927 // Ignore already existing network interfaces.
1130// this to succeed. If a network interface already exists, the
1131// returned error satisfies errors.IsAlreadyExists.
1132func (m *Machine) AddNetworkInterface(args NetworkInterfaceInfo) (iface *NetworkInterface, err error) {
854 _, err := m.st.AddNetwork(network)
855 if err != nil && errors.IsAlreadyExists(err) {
856 // Ignore already existing networks.
863 _, err := m.AddNetworkInterface(iface)
864 if err != nil && errors.IsAlreadyExists(err) {
865 // Ignore already existing network interfaces.
1013// this to succeed. If a network interface already exists, the
1014// returned error satisfies errors.IsAlreadyExists.
1015func (m *Machine) AddNetworkInterface(args NetworkInterfaceInfo) (iface *NetworkInterface, err error) {
216 })
217 if !errors.IsAlreadyExists(err) {
218 t.Errorf("Unexpected error returned: %#v", err)
250 err = registry.ApplyBinding(ctx, &api.Binding{PodID: "foo", Host: "machine"})
251 if !errors.IsAlreadyExists(err) {
252 t.Fatalf("Unexpected error returned: %#v", err)
908 })
909 if !errors.IsAlreadyExists(err) {
910 t.Errorf("expected already exists err, got %#v", err)
1003 })
1004 if !errors.IsAlreadyExists(err) {
1005 t.Errorf("expected already exists err, got %#v", err)
916 _, err := m.st.AddNetwork(network)
917 if err != nil && errors.IsAlreadyExists(err) {
918 // Ignore already existing networks.
925 _, err := m.AddNetworkInterface(iface)
926 if err != nil && errors.IsAlreadyExists(err) {
927 // Ignore already existing network interfaces.
1130// this to succeed. If a network interface already exists, the
1131// returned error satisfies errors.IsAlreadyExists.
1132func (m *Machine) AddNetworkInterface(args NetworkInterfaceInfo) (iface *NetworkInterface, err error) {
1447// network with the same name or provider id already exists in state,
1448// an error satisfying errors.IsAlreadyExists is returned.
1449func (st *State) AddNetwork(args NetworkInfo) (n *Network, err error) {
287 err := s.start()
288 if errors.IsAlreadyExists(err) {
289 logger.Debugf("service %q already running", s.Name())
443 err := s.install()
444 if errors.IsAlreadyExists(err) {
445 logger.Debugf("service %q already installed", s.Name())
900 _, err := m.st.AddNetwork(network)
901 if err != nil && errors.IsAlreadyExists(err) {
902 // Ignore already existing networks.
909 _, err := m.AddNetworkInterface(iface)
910 if err != nil && errors.IsAlreadyExists(err) {
911 // Ignore already existing network interfaces.
1093// this to succeed. If a network interface already exists, the
1094// returned error satisfies errors.IsAlreadyExists.
1095func (m *Machine) AddNetworkInterface(args NetworkInterfaceInfo) (iface *NetworkInterface, err error) {
897 _, err := m.st.AddNetwork(network)
898 if err != nil && errors.IsAlreadyExists(err) {
899 // Ignore already existing networks.
906 _, err := m.AddNetworkInterface(iface)
907 if err != nil && errors.IsAlreadyExists(err) {
908 // Ignore already existing network interfaces.
1090// this to succeed. If a network interface already exists, the
1091// returned error satisfies errors.IsAlreadyExists.
1092func (m *Machine) AddNetworkInterface(args NetworkInterfaceInfo) (iface *NetworkInterface, err error) {
86//
87// Any problem (including an existing file, see errors.IsAlreadyExists)
88// results in an error. If there is an error while storing either the
115// If a file has already been stored an error is returned (see
116// errors.IsAlreadyExists). Any other failure to add the file also
117// results in an error.
本文地址:https://www.itbaoku.cn/snippets/415690.html