Help us shape the future of Go! Take the 2026 Go Developer Survey

status

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2023 License: Apache-2.0, BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package status implements errors returned by MachineAPIs. MachineAPIs service handlers should return an error created by this package, and machineAPIs clients should expect a corresponding error to be returned from the RPC call.

This package upholds the invariants that a non-nil error may not contain an OK code, and an OK code must result in a nil error.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Error

func Error(c codes.Code, msg string) error

Error returns an error representing c and msg. If c is OK, returns nil.

Types

type Status

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

Status implements error and Status,

func FromError

func FromError(err error) (s *Status, ok bool)

FromError returns a Status representing err if it was produced from this package or has a method `GRPCStatus() *Status`. Otherwise, ok is false and a Status is returned with codes.Unknown and the original error message.

func New

func New(c codes.Code, msg string) *Status

New returns a Status representing c and msg.

func (*Status) Code

func (s *Status) Code() codes.Code

Code returns the status code contained in status.

func (*Status) Error

func (s *Status) Error() string

Error returns the error message for the status.

func (*Status) Message

func (s *Status) Message() string

Message returns the message contained in status.

Jump to

Keyboard shortcuts

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