errorx

package
v0.0.1-alpha.7 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewErrorTestServer

func NewErrorTestServer(t *testing.T, reg PersistenceProvider) *httptest.Server

func TestPersister

func TestPersister(p Persister) func(t *testing.T)

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(
	r handlerDependencies,
) *Handler

func (*Handler) RegisterPublicRoutes

func (h *Handler) RegisterPublicRoutes(public *x.RouterPublic)

type HandlerProvider

type HandlerProvider interface {
	SelfServiceErrorHandler() *Handler
}

type ManagementProvider

type ManagementProvider interface {
	// SelfServiceErrorManager returns the errorx.Manager.
	SelfServiceErrorManager() *Manager
}

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(d managerDependencies, c baseManagerConfiguration) *Manager

func (*Manager) ForwardError

func (m *Manager) ForwardError(ctx context.Context, w http.ResponseWriter, r *http.Request, errs ...error)

ForwardError is a simple helper that saves all errors in the store and forwards the HTTP Request to the error url, appending the error ID.

type PersistenceProvider

type PersistenceProvider interface {
	SelfServiceErrorPersister() Persister
}

type Persister

type Persister interface {
	// Add adds an error to the manager and returns a unique identifier or an error if insertion fails.
	Add(ctx context.Context, errs ...error) (uuid.UUID, error)

	// Read returns an error by its unique identifier and marks the error as read. If an error occurs during retrieval
	// the second return parameter is an error.
	Read(ctx context.Context, id uuid.UUID) ([]json.RawMessage, error)

	// Clear clears read containers that are older than a certain amount of time. If force is set to true, unread
	// errors will be cleared as well.
	Clear(ctx context.Context, olderThan time.Duration, force bool) error
}

Jump to

Keyboard shortcuts

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