// MarshalError convert go error to thrift exception, and encode exception over buffered binary transport.
MarshalError convert go error to thrift exception, and encode exception over buffered binary transport.
// MarshalError convert go error to thrift exception and encode exception over buffered binary transport .
func MarshalError(method string, err error) []byte {
	e := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, err.Error())
	var buf bytes.Buffer
	trans := thrift.NewStreamTransportRW(&buf)
	proto := thrift.NewTBinaryProtocol(trans, true, true)
	if err := proto.WriteMessageBegin(method, thrift.EXCEPTION, 0); err != nil {
		return nil
	}
	if err := e.Write(proto); err != nil {
		return nil
	}
	if err := proto.WriteMessageEnd(); err != nil {
		return nil
	}
	if err := proto.Flush(context.Background()); err != nil {
		return nil
	}
	return buf.Bytes()
}
func MarshalError ( method string , err error ) [ ] byte { e := thrift . NewTApplicationException ( thrift . INTERNAL_ERROR , err . Error ( ) ) var buf bytes . Buffer trans := thrift . NewStreamTransportRW ( & buf ) proto := thrift . NewTBinaryProtocol ( trans , true , true ) if err := proto . WriteMessageBegin ( method , thrift . EXCEPTION , 0 ) ; err != nil { return nil } if err := e . Write ( proto ) ; err != nil { return nil } if err := proto . WriteMessageEnd ( ) ; err != nil { return nil } if err := proto . Flush ( context . Background ( ) ) ; err != nil { return nil } return buf . Bytes ( ) }
MarshalError convert go error to thrift exception, and encode exception over buffered binary transport.
MarshalError convert go error to thrift exception and encode exception over buffered binary transport .