Files
abra/vendor/github.com/docker/cli/cli/error.go
decentral1se 1723025fbf build: go 1.24
We were running behind and there were quite some deprecations to update.
This was mostly in the upstream copy/pasta package but seems quite
minimal.
2025-03-16 12:31:45 +01:00

28 lines
642 B
Go

package cli
// StatusError reports an unsuccessful exit by a command.
type StatusError struct {
Cause error
Status string
StatusCode int
}
// Error formats the error for printing. If a custom Status is provided,
// it is returned as-is, otherwise it generates a generic error-message
// based on the StatusCode.
func (e StatusError) Error() string {
if e.Status != "" {
return e.Status
}
if e.Cause != nil {
return e.Cause.Error()
}
// we don't want to set a default message here,
// some commands might want to be explicit about the error message
return ""
}
func (e StatusError) Unwrap() error {
return e.Cause
}