first-commit
This commit is contained in:
47
modules/k8s/errors/errors.go
Normal file
47
modules/k8s/errors/errors.go
Normal file
@@ -0,0 +1,47 @@
|
||||
package errors
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type ErrIllegalDevcontainerParameters struct {
|
||||
FieldList []string
|
||||
Message string
|
||||
}
|
||||
|
||||
func (err ErrIllegalDevcontainerParameters) Error() string {
|
||||
return fmt.Sprintf("Illegal DevContainer parameters detected: %v (%s)", err.FieldList, err.Message)
|
||||
}
|
||||
|
||||
type ErrOperateDevcontainer struct {
|
||||
Action string
|
||||
Message string
|
||||
}
|
||||
|
||||
func (err ErrOperateDevcontainer) Error() string {
|
||||
return fmt.Sprintf("Failed to %v in DevStar DevContainer DB: %v", err.Action, err.Message)
|
||||
}
|
||||
|
||||
// ErrOpenDevcontainerTimeout 阻塞式等待 DevContainer 超时
|
||||
type ErrOpenDevcontainerTimeout struct {
|
||||
Name string
|
||||
Namespace string
|
||||
TimeoutSeconds int64
|
||||
}
|
||||
|
||||
func (err ErrOpenDevcontainerTimeout) Error() string {
|
||||
return fmt.Sprintf("Failed to open DevContainer '%s' in namespace '%s': waiting timeout limit of %d seconds has been exceeded.",
|
||||
err.Name, err.Namespace, err.TimeoutSeconds,
|
||||
)
|
||||
}
|
||||
|
||||
type ErrK8sDevcontainerNotReady struct {
|
||||
Name string
|
||||
Namespace string
|
||||
Wait bool
|
||||
}
|
||||
|
||||
func (err ErrK8sDevcontainerNotReady) Error() string {
|
||||
return fmt.Sprintf("Failed to open k8s Devcontainer '%s' in namespace '%s': DevContainer Not Ready (Wait = %v)",
|
||||
err.Name, err.Namespace, err.Wait)
|
||||
}
|
Reference in New Issue
Block a user