errors

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAborted = errors.New("operation aborted")

Functions

This section is empty.

Types

type CliError

type CliError struct {

	// The original error that triggers this CLI error.
	// The Err.String() will be print in red to the user.
	Err error

	// Message allow to override the red message shown to the use.
	// By default, we will use Err.String() but in same case you may want to keep Err
	// to avoid loosing detail in json output.
	Message string

	Details string
	Hint    string

	// Code allows to return a specific error code from the main binary.
	Code int

	// Empty tells the marshaler to not print any message for the error
	Empty bool
}

CliError is an all-in-one error structure that can be used in commands to return useful errors to the user. CliError implements JSON and human marshaler for a smooth experience.

func ParseCloudErr

func ParseCloudErr(body []byte) *CliError

TODO: It's not CLI work. SDK should do it.

func (*CliError) Error

func (s *CliError) Error() string

func (*CliError) MarshalHuman

func (s *CliError) MarshalHuman() (string, error)

func (*CliError) MarshalJSON

func (s *CliError) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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