mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-30 09:13:29 +00:00
errors: Create a new standard error for invalid config
Refactor a common error into a new standard error object. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
This commit is contained in:
parent
e803a7f870
commit
97beb2b2d4
@ -189,7 +189,7 @@ func (k *kataAgent) init(ctx context.Context, sandbox *Sandbox, config interface
|
|||||||
}
|
}
|
||||||
k.keepConn = c.LongLiveConn
|
k.keepConn = c.LongLiveConn
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("Invalid config type")
|
return vcTypes.ErrInvalidConfigType
|
||||||
}
|
}
|
||||||
|
|
||||||
k.proxy, err = newProxy(sandbox.config.ProxyType)
|
k.proxy, err = newProxy(sandbox.config.ProxyType)
|
||||||
@ -241,7 +241,7 @@ func (k *kataAgent) internalConfigure(h hypervisor, id, sharePath string, builti
|
|||||||
}
|
}
|
||||||
k.keepConn = c.LongLiveConn
|
k.keepConn = c.LongLiveConn
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("Invalid config type")
|
return vcTypes.ErrInvalidConfigType
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -275,7 +275,7 @@ func (k *kataAgent) configure(h hypervisor, id, sharePath string, builtin bool,
|
|||||||
}
|
}
|
||||||
k.vmSocket = s
|
k.vmSocket = s
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("Invalid config type")
|
return vcTypes.ErrInvalidConfigType
|
||||||
}
|
}
|
||||||
|
|
||||||
// Neither create shared directory nor add 9p device if hypervisor
|
// Neither create shared directory nor add 9p device if hypervisor
|
||||||
|
@ -11,9 +11,10 @@ import (
|
|||||||
|
|
||||||
// common error objects used for argument checking
|
// common error objects used for argument checking
|
||||||
var (
|
var (
|
||||||
ErrNeedSandbox = errors.New("Sandbox must be specified")
|
ErrNeedSandbox = errors.New("Sandbox must be specified")
|
||||||
ErrNeedSandboxID = errors.New("Sandbox ID cannot be empty")
|
ErrNeedSandboxID = errors.New("Sandbox ID cannot be empty")
|
||||||
ErrNeedContainerID = errors.New("Container ID cannot be empty")
|
ErrNeedContainerID = errors.New("Container ID cannot be empty")
|
||||||
ErrNeedState = errors.New("State cannot be empty")
|
ErrNeedState = errors.New("State cannot be empty")
|
||||||
ErrNoSuchContainer = errors.New("Container does not exist")
|
ErrNoSuchContainer = errors.New("Container does not exist")
|
||||||
|
ErrInvalidConfigType = errors.New("Invalid config type")
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user