mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
94fb37f557
Currently we have a problem when buffers are used for std file descriptors. These buffers are filled from goroutines (Cmd.goroutine), and we need to wait them to be sure that all data have been copied. Signed-off-by: Andrew Vagin <avagin@openvz.org>
63 lines
1.1 KiB
Go
63 lines
1.1 KiB
Go
package libcontainer
|
|
|
|
import "io"
|
|
|
|
// API error code type.
|
|
type ErrorCode int
|
|
|
|
// API error codes.
|
|
const (
|
|
// Factory errors
|
|
IdInUse ErrorCode = iota
|
|
InvalidIdFormat
|
|
|
|
// Container errors
|
|
ContainerNotExists
|
|
ContainerPaused
|
|
ContainerNotStopped
|
|
ContainerNotRunning
|
|
|
|
// Process errors
|
|
ProcessNotExecuted
|
|
|
|
// Common errors
|
|
ConfigInvalid
|
|
SystemError
|
|
)
|
|
|
|
func (c ErrorCode) String() string {
|
|
switch c {
|
|
case IdInUse:
|
|
return "Id already in use"
|
|
case InvalidIdFormat:
|
|
return "Invalid format"
|
|
case ContainerPaused:
|
|
return "Container paused"
|
|
case ConfigInvalid:
|
|
return "Invalid configuration"
|
|
case SystemError:
|
|
return "System error"
|
|
case ContainerNotExists:
|
|
return "Container does not exist"
|
|
case ContainerNotStopped:
|
|
return "Container is not stopped"
|
|
case ContainerNotRunning:
|
|
return "Container is not running"
|
|
default:
|
|
return "Unknown error"
|
|
}
|
|
}
|
|
|
|
// API Error type.
|
|
type Error interface {
|
|
error
|
|
|
|
// Returns a verbose string including the error message
|
|
// and a representation of the stack trace suitable for
|
|
// printing.
|
|
Detail(w io.Writer) error
|
|
|
|
// Returns the error code for this error.
|
|
Code() ErrorCode
|
|
}
|