diff --git a/virtcontainers/kata_agent.go b/virtcontainers/kata_agent.go index e5f2844be..80aa151cc 100644 --- a/virtcontainers/kata_agent.go +++ b/virtcontainers/kata_agent.go @@ -189,7 +189,7 @@ func (k *kataAgent) init(ctx context.Context, sandbox *Sandbox, config interface } k.keepConn = c.LongLiveConn default: - return fmt.Errorf("Invalid config type") + return vcTypes.ErrInvalidConfigType } 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 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 default: - return fmt.Errorf("Invalid config type") + return vcTypes.ErrInvalidConfigType } // Neither create shared directory nor add 9p device if hypervisor diff --git a/virtcontainers/pkg/types/errors.go b/virtcontainers/pkg/types/errors.go index 214022708..097ee231b 100644 --- a/virtcontainers/pkg/types/errors.go +++ b/virtcontainers/pkg/types/errors.go @@ -11,9 +11,10 @@ import ( // common error objects used for argument checking var ( - ErrNeedSandbox = errors.New("Sandbox must be specified") - ErrNeedSandboxID = errors.New("Sandbox ID cannot be empty") - ErrNeedContainerID = errors.New("Container ID cannot be empty") - ErrNeedState = errors.New("State cannot be empty") - ErrNoSuchContainer = errors.New("Container does not exist") + ErrNeedSandbox = errors.New("Sandbox must be specified") + ErrNeedSandboxID = errors.New("Sandbox ID cannot be empty") + ErrNeedContainerID = errors.New("Container ID cannot be empty") + ErrNeedState = errors.New("State cannot be empty") + ErrNoSuchContainer = errors.New("Container does not exist") + ErrInvalidConfigType = errors.New("Invalid config type") )