common

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TemporaryError

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

TemporaryError wraps an error with the a temporary error code required by other services like `csi-provisioner`. It implements the error interface. Do not return `TemporaryError` directly from CSI Spec API calls, as CSI Spec API calls MUST return a standard gRPC status. If TemporaryErrors are returned from helper functions within a CSI Spec API method, make sure the outer CSI Spec API method returns a standard gRPC status.

func NewTemporaryError

func NewTemporaryError(code codes.Code, err error) *TemporaryError

NewTemporaryError constructs a new `TemporaryError` instance.

This function creates a TemporaryError by wrapping the given error (`err`) and assigning it a specific error code (`code`).

func (*TemporaryError) Error

func (t *TemporaryError) Error() string

Error returns a readable representation of the TemporaryError.

func (*TemporaryError) GRPCStatus

func (t *TemporaryError) GRPCStatus() *status.Status

GRPCStatus extracts the underlying gRPC Status error. This method is necessary to fulfill the grpcstatus interface described in https://pkg.go.dev/google.golang.org/grpc/status#FromError. `FromError` is used in `CodeForError` to get existing error codes from status errors.

func (*TemporaryError) Unwrap

func (t *TemporaryError) Unwrap() error

Unwrap extracts the original error.

Jump to

Keyboard shortcuts

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