errors

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExitOK         = 0
	ExitGeneral    = 1
	ExitAuth       = 2
	ExitNotFound   = 3
	ExitValidation = 4
	ExitAPI        = 5
	ExitNetwork    = 6
	ExitCancelled  = 10
)

Variables

This section is empty.

Functions

func GetExitCode

func GetExitCode(err error) int

GetExitCode returns the exit code for the given error. If the error implements the ExitCoder interface its code is returned; otherwise ExitGeneral is returned.

Types

type APIError

type APIError struct {
	StatusCode int
	Code       string
	Message    string
}

APIError represents an error returned by the ConoHa API.

func (*APIError) Error

func (e *APIError) Error() string

func (*APIError) ExitCode

func (e *APIError) ExitCode() int

type AuthError

type AuthError struct {
	Message string
}

AuthError represents an authentication or authorization failure.

func (*AuthError) Error

func (e *AuthError) Error() string

func (*AuthError) ExitCode

func (e *AuthError) ExitCode() int

type ConfigError

type ConfigError struct {
	Message string
}

ConfigError represents a configuration problem.

func (*ConfigError) Error

func (e *ConfigError) Error() string

func (*ConfigError) ExitCode

func (e *ConfigError) ExitCode() int

type ExitCoder

type ExitCoder interface {
	ExitCode() int
}

ExitCoder is implemented by errors that carry a process exit code.

type NetworkError

type NetworkError struct {
	Err error
}

NetworkError wraps an underlying network-level error.

func (*NetworkError) Error

func (e *NetworkError) Error() string

func (*NetworkError) ExitCode

func (e *NetworkError) ExitCode() int

func (*NetworkError) Unwrap

func (e *NetworkError) Unwrap() error

type NotFoundError

type NotFoundError struct {
	Resource string
	ID       string
}

NotFoundError indicates that a requested resource was not found.

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

func (*NotFoundError) ExitCode

func (e *NotFoundError) ExitCode() int

type ValidationError

type ValidationError struct {
	Field   string
	Message string
}

ValidationError represents invalid user input.

func (*ValidationError) Error

func (e *ValidationError) Error() string

func (*ValidationError) ExitCode

func (e *ValidationError) ExitCode() int

Jump to

Keyboard shortcuts

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