package grpcerrors
import "github.com/moby/buildkit/util/grpcerrors"
Index ¶
- func AsGRPCStatus(err error) (*status.Status, bool)
- func Code(err error) codes.Code
- func FromGRPC(err error) error
- func StreamClientInterceptor(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error)
- func StreamServerInterceptor(srv any, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error
- func ToGRPC(ctx context.Context, err error) error
- func UnaryClientInterceptor(ctx context.Context, method string, req, reply any, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error
- func UnaryServerInterceptor(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp any, err error)
- func WrapCode(err error, code codes.Code) error
- type TypedError
- type TypedErrorProto
Functions ¶
func AsGRPCStatus ¶
AsGRPCStatus tries to extract a gRPC status from the error. Supports `Unwrap() error` and `Unwrap() []error` for wrapped errors. When the `Unwrap() []error` returns multiple errors, the first one that contains a gRPC status is returned.
func Code ¶
Code returns the gRPC status code for the given error. If the error type has a `Code() codes.Code` method, it is used. If the error type has a `GRPCStatus() *status.Status` method, its code is used. As a fallback: Supports `Unwrap() error` and `Unwrap() []error` for wrapped errors. When the `Unwrap() []error` returns multiple errors, the first one that contains a non-OK code is returned. Finally, if the error is a context error, the corresponding code is returned.
func FromGRPC ¶
func StreamClientInterceptor ¶
func StreamClientInterceptor(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error)
func StreamServerInterceptor ¶
func StreamServerInterceptor(srv any, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error
func ToGRPC ¶
func UnaryClientInterceptor ¶
func UnaryClientInterceptor(ctx context.Context, method string, req, reply any, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error
func UnaryServerInterceptor ¶
func UnaryServerInterceptor(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp any, err error)
func WrapCode ¶
Types ¶
type TypedError ¶
type TypedError interface {
ToProto() TypedErrorProto
}
type TypedErrorProto ¶
Source Files ¶
- Version
- v0.25.0-rc1
- Published
- Sep 23, 2025
- Platform
- darwin/amd64
- Imports
- 16 packages
- Last checked
- 8 minutes ago –
Tools for package owners.