498b235461
Build and test / Build and test AMD64 Ubuntu 22.04 (push) Failing after 0s
Publish Builder / amazonlinux2023 (push) Failing after 1s
Build and test / UT for Go (push) Has been skipped
Publish KRTE Images / KRTE (push) Failing after 1s
Build and test / Integration Test (push) Has been skipped
Build and test / Upload Code Coverage (push) Has been skipped
Publish Builder / rockylinux9 (push) Failing after 1s
Publish Builder / ubuntu22.04 (push) Failing after 0s
Publish Builder / ubuntu24.04 (push) Failing after 0s
Publish Gpu Builder / publish-gpu-builder (push) Failing after 1s
Publish Test Images / PyTest (push) Failing after 0s
Build and test / UT for Cpp (push) Has been cancelled
35 lines
878 B
Go
35 lines
878 B
Go
package status
|
|
|
|
import (
|
|
"google.golang.org/grpc"
|
|
)
|
|
|
|
// NewClientStreamWrapper returns a grpc.ClientStream that wraps the given stream.
|
|
func NewClientStreamWrapper(method string, stream grpc.ClientStream) grpc.ClientStream {
|
|
if stream == nil {
|
|
return nil
|
|
}
|
|
return &clientStreamWrapper{
|
|
method: method,
|
|
ClientStream: stream,
|
|
}
|
|
}
|
|
|
|
// clientStreamWrapper wraps a grpc.ClientStream and converts errors to Status.
|
|
type clientStreamWrapper struct {
|
|
method string
|
|
grpc.ClientStream
|
|
}
|
|
|
|
// Convert the error to a Status and return it.
|
|
func (s *clientStreamWrapper) SendMsg(m interface{}) error {
|
|
err := s.ClientStream.SendMsg(m)
|
|
return ConvertStreamingError(s.method, err)
|
|
}
|
|
|
|
// Convert the error to a Status and return it.
|
|
func (s *clientStreamWrapper) RecvMsg(m interface{}) error {
|
|
err := s.ClientStream.RecvMsg(m)
|
|
return ConvertStreamingError(s.method, err)
|
|
}
|