errmessages

package
v0.5.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 14, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

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

func NewToDisplayError(err error) error

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL