errors

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package errors provides an optional renderer for render failures.

Index

Constants

View Source
const RenderKindError partial.RenderKind = "error"

RenderKindError is the renderer kind used for error fragments.

Variables

This section is empty.

Functions

func ExtractTemplateLocation

func ExtractTemplateLocation(err error) string

ExtractTemplateLocation extracts a template file and line from an error message.

func Stage

func Stage(options ...Option) partial.RenderStage

Stage returns a render stage that handles error render contexts.

Types

type Data

type Data struct {
	Error         error
	Message       string
	PartialID     string
	Templates     []string
	Request       *http.Request
	URL           *url.URL
	Location      string
	Detailed      bool
	TemplateLabel string
}

Data is the template data used by the error renderer.

func BuildData

func BuildData(ctx *partial.RenderContext, mode Mode) Data

BuildData converts a render context into error template data.

type Mode

type Mode int

Mode controls how much error detail is rendered.

const (
	// ModeSafe hides detailed error messages from rendered output.
	ModeSafe Mode = iota
	// ModeDetailed includes diagnostic error details in rendered output.
	ModeDetailed
)

type Option

type Option func(*config)

Option configures the error renderer.

func WithMode

func WithMode(mode Mode) Option

WithMode configures the error detail mode.

Jump to

Keyboard shortcuts

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