Documentation
¶
Overview ¶
Package errmessages formats the error messages that are sent to the client.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatErrorMessage ¶
func FormatErrorMessage(ctx context.Context, method string, req, reply any, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error
FormatErrorMessage formats the error message received by the client to avoid printing useless information.
It converts the gRPC error to a more human-readable error with a better message.
func NewToDisplayError ¶
NewToDisplayError returns a new ErrorToDisplay.
func RedactErrorInterceptor ¶
func RedactErrorInterceptor(ctx context.Context, req any, _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (any, error)
RedactErrorInterceptor redacts some of the attached errors before sending it to the client.
It unwraps the error up to the first ErrToDisplay and sends it to the client. If none is found, it sends the original error.
Types ¶
type ToDisplayError ¶
type ToDisplayError struct {
// contains filtered or unexported fields
}
ToDisplayError defines an error that needs to be sent unaltered to the client.
Click to show internal directories.
Click to hide internal directories.