errmessages

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: GPL-3.0, LGPL-3.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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