Differentiate between server error messages and client error messages in kubectl

This commit is contained in:
Brendan Burns
2015-03-03 16:24:29 -08:00
parent 53ec66caf4
commit f505a33998
22 changed files with 142 additions and 114 deletions

View File

@@ -262,6 +262,18 @@ func IsServerTimeout(err error) bool {
return reasonForError(err) == api.StatusReasonServerTimeout
}
// IsStatusError determines if err is an API Status error received from the master.
func IsStatusError(err error) bool {
_, ok := err.(*StatusError)
return ok
}
// IsUnexpectedObjectError determines if err is due to an unexpected object from the master.
func IsUnexpectedObjectError(err error) bool {
_, ok := err.(*UnexpectedObjectError)
return ok
}
func reasonForError(err error) api.StatusReason {
switch t := err.(type) {
case *StatusError: