errors

package
v2.7.0-beta1 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: MPL-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package errors provides error handling utilities with colored terminal output for the CLI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConflictingFlagsError

func NewConflictingFlagsError(flagA, flagB, reason string) error

NewConflictingFlagsError creates an error for two flags that cannot be used together. The message names both flags so the user can see which pair to resolve.

func NewDirectoryInaccessibleError

func NewDirectoryInaccessibleError(err error) error

NewDirectoryInaccessibleError creates an error for when a directory cannot be accessed.

func NewFlagFileError

func NewFlagFileError(flag, path string, err error) error

NewFlagFileError creates an error for a flag whose file value cannot be read.

func NewNotADirectoryError

func NewNotADirectoryError(path string) error

NewNotADirectoryError creates an error for when a path is not a directory.

func NewPathNotSpecifiedError

func NewPathNotSpecifiedError() error

NewPathNotSpecifiedError creates an error for when a path is not specified.

Types

type ErrorType

type ErrorType int
const (
	TypeHint ErrorType = iota
	TypeError
)

func (ErrorType) IsFatalError

func (et ErrorType) IsFatalError() bool

IsFatalError returns true if the error type is fatal and should cause the program to exit.

type FlagError

type FlagError struct {
	Type ErrorType
	Msg  string
}

FlagError describes a problem with the value of a CLI flag, or with a combination of flags that express contradictory intent.

func (*FlagError) Error

func (e *FlagError) Error() string

Error implements the error interface.

func (*FlagError) HandlerString

func (e *FlagError) HandlerString() string

HandlerString returns a colored error string for CLI display.

type InputDirectoryError

type InputDirectoryError struct {
	Type ErrorType
	Msg  string
}

func (*InputDirectoryError) Error

func (e *InputDirectoryError) Error() string

Error implements the error interface.

func (*InputDirectoryError) HandlerString

func (e *InputDirectoryError) HandlerString() string

HandlerString returns a colored error string for CLI display.

Jump to

Keyboard shortcuts

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