errors

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2025 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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