endpoint

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2021 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientErrorMiddleware deprecated

func ClientErrorMiddleware(e endpoint.Endpoint) endpoint.Endpoint

ClientErrorMiddleware checks returned errors of the subsequent endpoint. Errors matching the client error criteria get wrapped in an endpoint.Failer response. An error is considered to be a client error if it implements the following interface:

type clientError interface {
	ClientError() bool
}

and `ClientError` returns true.

Deprecated: use ServiceErrorMiddleware instead.

func LoggingMiddleware

func LoggingMiddleware(logger Logger) endpoint.Middleware

LoggingMiddleware logs trace information about every request (beginning of the request, processing time).

The logger might extract additional information from the context (correlation ID, operation name, etc).

func ServiceErrorMiddleware added in v0.6.0

func ServiceErrorMiddleware(e endpoint.Endpoint) endpoint.Endpoint

ServiceErrorMiddleware checks returned errors of the subsequent endpoint. Errors matching the client error criteria get wrapped in an endpoint.Failer response. An error is considered to be a client error if it implements the following interface:

type serviceError interface {
	ServiceError() bool
}

and `ServiceError` returns true.

Types

type Logger

type Logger interface {
	// TraceContext logs a Trace event.
	TraceContext(ctx context.Context, msg string, fields ...map[string]interface{})
}

Logger logs certain events of the application.

Jump to

Keyboard shortcuts

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