errs

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package errs formats coded errors: every "must not" in the framework is reported with a code, an optional file:line, a one-line fix and a link to its docs page.

Index

Constants

View Source
const DocsBase = "https://aicoded.dev/docs/errors/"

DocsBase is the address of the error catalogue; a code's page is DocsBase + code.

Variables

This section is empty.

Functions

func Code

func Code(err error) string

Code returns the code of the first coded error in err's chain, or "".

Types

type Error

type Error struct {
	Code string // E-AREA-NNN
	Pos  string // file:line; empty when there is no source position
	Msg  string
	Fix  string
}

Error is a coded error.

func At

func At(pos, code, msg, fix string) *Error

At returns a coded error at a source position (file:line).

func New

func New(code, msg, fix string) *Error

New returns a coded error without a source position.

func Parse

func Parse(msg string) (*Error, bool)

Parse reads back the text an Error without a position prints, such as a runner's refusal that crossed a socket: the code, the message and the optional fix and docs lines. A missing fix reads as "read the docs page below". It returns false when msg does not start with a code.

func (*Error) Error

func (e *Error) Error() string

Jump to

Keyboard shortcuts

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