func FromContextError(err error) *Status {
	switch err {
	case nil:
		return nil
	case context.DeadlineExceeded:
		return New(codes.DeadlineExceeded, err.Error())
	case context.Canceled:
		return New(codes.Canceled, err.Error())
	default:
		return New(codes.Unknown, err.Error())
	}
}
FromContextError converts a context error into a Status.  It returns a
Status with codes.OK if err is nil, or a Status with codes.Unknown if err is
non-nil and not a context error.
package status
import (
	"context"
	"fmt"
	spb "google.golang.org/genproto/googleapis/rpc/status"
	"google.golang.org/grpc/codes"
	"google.golang.org/grpc/internal/status"
)
type Status = status.Status
func New(c codes.Code, msg string) *Status {
	return status.New(c, msg)
}
func Newf(c codes.Code, format string, a ...interface{}) *Status {
	return New(c, fmt.Sprintf(format, a...))
}
func Error(c codes.Code, msg string) error {
	return New(c, msg).Err()
}
func Errorf(c codes.Code, format string, a ...interface{}) error {
	return Error(c, fmt.Sprintf(format, a...))
}
func ErrorProto(s *spb.Status) error {
	return FromProto(s).Err()
}
func FromProto(s *spb.Status) *Status {
	return status.FromProto(s)
}
func FromError(err error) (s *Status, ok bool) {
	if err == nil {
		return nil, true
	}
	if se, ok := err.(interface {
		GRPCStatus() *Status
	}); ok {
		return se.GRPCStatus(), true
	}
	return New(codes.Unknown, err.Error()), false
}
func Convert(err error) *Status {
	s, _ := FromError(err)
	return s
}
func Code(err error) codes.Code {
	if err == nil {
		return codes.OK
	}
	if se, ok := err.(interface {
		GRPCStatus() *Status
	}); ok {
		return se.GRPCStatus().Code()
	}
	return codes.Unknown
}