errorhandling

package
v3.4.7 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2022 License: Apache-2.0 Imports: 5 Imported by: 20

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseQuiet

func CloseQuiet(f *os.File)

CloseQuiet closes a file and logs any error. Should only be used within a defer.

func Contains

func Contains(err error, sub error) bool

Contains checks if err's message contains sub's message. Contains should be used iff either err or sub has lost type information (e.g., due to marshaling). For typed errors, please use `errors.Contains(...)` or `Is()` in recent version of Go.

func ErrorsToStrings

func ErrorsToStrings(errs []error) []string

ErrorsToString converts the slice of errors into a slice of corresponding error messages.

func JoinErrors

func JoinErrors(errs []error) error

JoinErrors converts the error slice into a single human-readable error.

func StringsToErrors

func StringsToErrors(strErrs []string) []error

StringsToErrors converts a slice of error messages into a slice of corresponding errors.

func SyncQuiet

func SyncQuiet(f *os.File)

SyncQuiet syncs a file and logs any error. Should only be used within a defer.

Types

type ErrorModel

type ErrorModel struct {
	// API root cause formatted for automated parsing
	// example: API root cause
	Because string `json:"cause"`
	// human error message, formatted for a human to read
	// example: human error message
	Message string `json:"message"`
	// http response code
	ResponseCode int `json:"response"`
}

ErrorModel is used in remote connections with podman

func (ErrorModel) Cause

func (e ErrorModel) Cause() error

func (ErrorModel) Code

func (e ErrorModel) Code() int

func (ErrorModel) Error

func (e ErrorModel) Error() string

type PodConflictErrorModel added in v3.4.2

type PodConflictErrorModel struct {
	Errs []string
	Id   string //nolint
}

PodConflictErrorModel is used in remote connections with podman

func (PodConflictErrorModel) Code added in v3.4.2

func (e PodConflictErrorModel) Code() int

func (PodConflictErrorModel) Error added in v3.4.2

func (e PodConflictErrorModel) Error() string

Jump to

Keyboard shortcuts

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