errorx

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const RouteGet = "/self-service/errors"

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorContainer

type ErrorContainer struct {
	// ID of the error container.
	//
	// required: true
	ID  uuid.UUID `db:"id" json:"id"`
	NID uuid.UUID `json:"-" db:"nid"`

	// The error
	Errors json.RawMessage `json:"error" db:"errors"`

	// CreatedAt is a helper struct field for gobuffalo.pop.
	CreatedAt time.Time `json:"created_at" db:"created_at"`

	// UpdatedAt is a helper struct field for gobuffalo.pop.
	UpdatedAt time.Time `json:"updated_at" db:"updated_at"`

	SeenAt    sql.NullTime `json:"-" db:"seen_at"`
	WasSeen   bool         `json:"-" db:"was_seen"`
	CSRFToken string       `db:"csrf_token" json:"-"`
}

swagger:model flowError

func (ErrorContainer) TableName

func (e ErrorContainer) TableName(ctx context.Context) string

type Handler

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

func NewHandler

func NewHandler(
	r handlerDependencies,
) *Handler

func (*Handler) RegisterAdminRoutes

func (h *Handler) RegisterAdminRoutes(public *x.RouterAdmin)

func (*Handler) RegisterPublicRoutes

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

func (*Handler) WithTokenGenerator

func (h *Handler) WithTokenGenerator(f func(r *http.Request) string)

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) *Manager

func (*Manager) Create

func (m *Manager) Create(ctx context.Context, w http.ResponseWriter, r *http.Request, err error) (string, error)

Create is a simple helper that saves all errors in the store and returns the error url, appending the error ID.

func (*Manager) Forward

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

Forward 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 {
	// CreateErrorContainer adds an error to the manager and returns a
	// unique identifier or an error if insertion fails.
	CreateErrorContainer(ctx context.Context, csrfToken string, err error) (uuid.UUID, error)

	// ReadErrorContainer 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.
	ReadErrorContainer(ctx context.Context, id uuid.UUID) (*ErrorContainer, error)

	// ClearErrorContainers 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.
	ClearErrorContainers(ctx context.Context, olderThan time.Duration, force bool) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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