serror

package
v0.0.0-...-f49f154 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Provides functionality for bubbling internal errors up to the user in a pretty and concise way

Index

Constants

View Source
const (
	ANSI_RESET   = "\033[0m"
	ANSI_RED     = "\033[91m"
	ANSI_YELLOW  = "\033[93m"
	ANSI_BLUE    = "\033[94m"
	ANSI_MAGENTA = "\033[95m"
)
View Source
const MAX_ERRORS = 3

Variables

This section is empty.

Functions

func Add

func Add(t *token.Token, title string, info string, additional ...any)

func Display

func Display()

func HasErrors

func HasErrors() bool

func Panic

func Panic()

func SetDefault

func SetDefault(e *ErrorFormatter)

Types

type Error

type Error struct {
	Token *token.Token
	Title string // smth like Unknown token
	Info  string // in depth information: expected 'x' got 'y'
}

type ErrorFormatter

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

func Default

func Default() *ErrorFormatter

func NewFormatter

func NewFormatter(config *core.Config, input string, filename string, w io.Writer) *ErrorFormatter

func (*ErrorFormatter) Add

func (e *ErrorFormatter) Add(t *token.Token, title string, info string, additional ...any)

func (*ErrorFormatter) Display

func (e *ErrorFormatter) Display()

func (*ErrorFormatter) HasErrors

func (e *ErrorFormatter) HasErrors() bool

Jump to

Keyboard shortcuts

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