// MarshalError will marshall the error and add to the context
MarshalError will marshall the error and add to the context
// MarshalError will marshall the error and add to the context
func MarshalError(err error, ctx context.Context) error {
	rErr, ok := err.(*Error)
	if !ok {
		return err
	}
	pbErr, marshallerr := proto.Marshal(rErr)
	if marshallerr == nil {
		md := metadata.Pairs("rpc-error", base64.StdEncoding.EncodeToString(pbErr))
		_ = grpc.SetTrailer(ctx, md)
	}
	return status.Errorf(codes.Code(rErr.Code), rErr.Message)
}
func MarshalError ( err error , ctx context . Context ) error { rErr , ok := err . ( * Error ) if ! ok { return err } pbErr , marshallerr := proto . Marshal ( rErr ) if marshallerr == nil { md := metadata . Pairs ( " " , base64 . StdEncoding . EncodeToString ( pbErr ) ) _ = grpc . SetTrailer ( ctx , md ) } return status . Errorf ( codes . Code ( rErr . Code ) , rErr . Message ) }
MarshalError will marshall the error and add to the context
MarshalError will marshall the error and add to the context