code: func GetErrorPayload(serializer serialize.Serializer, err error) ([]byte, error) {
  	code := e.ErrUnknownCode
  	msg := err.Error()
  	metadata := map[string]string{}
  	if val, ok := err.(*e.Error); ok {
  		code = val.Code
  		metadata = val.Metadata
  	}
  	errPayload := &protos.Error{
  		Code: code,
  		Msg:  msg,
  	}
  	if len(metadata) > 0 {
  		errPayload.Metadata = metadata
  	}
  	return SerializeOrRaw(serializer, errPayload)
  }
docs: // GetErrorPayload creates and serializes an error payload