func FromObject(obj runtime.Object) error {
	switch t := obj.(type) {
	case *unversioned.Status:
		return &StatusError{*t}
	}
	return &UnexpectedObjectError{obj}
}
FromObject generates an StatusError from an unversioned.Status, if that is the type of obj; otherwise,
returns an UnexpecteObjectError.
package errors
import (
	"encoding/json"
	"fmt"
	"net/http"
	"strings"
	"k8s.io/client-go/pkg/api/unversioned"
	"k8s.io/client-go/pkg/runtime"
	"k8s.io/client-go/pkg/util/validation/field"
)
const (
	StatusUnprocessableEntity = 422
	StatusTooManyRequests     = 429
	StatusServerTimeout = 504
)
type StatusError struct {
	ErrStatus unversioned.Status
}
type APIStatus interface {
	Status() unversioned.Status
}
var _ error = &StatusError{}
func (e *StatusError) Error() string {
	return e.ErrStatus.Message
}
func (e *StatusError) Status() unversioned.Status {
	return e.ErrStatus
}
func (e *StatusError) DebugError() (string, []interface{}) {
	if out, err := json.MarshalIndent(e.ErrStatus, "", "  "); err == nil {
		return "server response object: %s", []interface{}{string(out)}
	}
	return "server response object: %#v", []interface{}{e.ErrStatus}
}
type UnexpectedObjectError struct {
	Object runtime.Object
}
func (u *UnexpectedObjectError) Error() string {
	return fmt.Sprintf("unexpected object: %v", u.Object)
}