cberr

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package cberr contains all types/interfaces related to customized errors for cli.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorExitCode

func ErrorExitCode(err error) int

ErrorExitCode returns the exit code of the root error, if available.

func ErrorMessage

func ErrorMessage(err error) string

ErrorMessage returns the human-readable message of the error, if available.

Types

type Code

type Code int

Code is the type of machine-readable error code.

const (
	UnclassifiedErr Code = iota
	ConfigErr
	HTTPConnectionErr
	HTTPUnsuccessfulResponseErr
	HTTPNotFoundErr
	HTTPNotAllowedErr
	SBOMGenerationErr
	LayersGenerationErr
	ScanFailedErr
	ValidateFailedErr
	TimeoutErr
	DisplayErr
	PolicyViolationErr
)

ErrCode types.

func ErrorCode

func ErrorCode(err error) Code

ErrorCode returns the code of the root error, if available.

type Error

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

Error is the customized error type for cli, implement the builtin error interface.

func NewError

func NewError(code Code, message string, err error) *Error

NewError initializes a new cli-error.

func (*Error) Error

func (e *Error) Error() string

Error returns the string representation of the error message.

func (*Error) ExitCode

func (e *Error) ExitCode() int

ExitCode returns the code for this error.

Jump to

Keyboard shortcuts

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