gcerrors

package
v0.50.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2026 License: Apache-2.0 Imports: 3 Imported by: 248 modules, 327 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

Overview

Package gcerrors provides support for getting error codes from errors returned by Go CDK APIs.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnknown means that the error could not be categorized.
	ErrUnknown = gcerr.ErrUnknown

	// ErrNotFound means that the resource was not found.
	ErrNotFound = gcerr.ErrNotFound

	// ErrAlreadyExists means that the resource exists, but it should not.
	ErrAlreadyExists = gcerr.ErrAlreadyExists

	// ErrInvalidArgument means that a value given to a Go CDK API is incorrect.
	ErrInvalidArgument = gcerr.ErrInvalidArgument

	// ErrInternal means that something unexpected happened. Internal errors always indicate
	// bugs in the Go CDK (or possibly the underlying service).
	ErrInternal = gcerr.ErrInternal

	// ErrUnimplemented means that the feature is not implemented.
	ErrUnimplemented = gcerr.ErrUnimplemented

	// ErrFailedPrecondition means that the system was in the wrong state.
	ErrFailedPrecondition = gcerr.ErrFailedPrecondition

	// ErrPermissionDenied means that the caller does not have permission to execute the specified operation.
	ErrPermissionDenied = gcerr.ErrPermissionDenied

	// ErrResourceExhausted means that some resource has been exhausted, typically because a service resource limit
	// has been reached.
	ErrResourceExhausted = gcerr.ErrResourceExhausted

	// ErrCanceled means that the operation was canceled.
	ErrCanceled = gcerr.ErrCanceled

	// ErrDeadlinedExceeded means that the operation timed out.
	ErrDeadlineExceeded = gcerr.ErrDeadlineExceeded
)

Functions

This section is empty.

Types

type ErrorCode

type ErrorCode = gcerr.ErrorCode

An ErrorCode describes the error's category. Programs should act upon an error's code, not its message.

const (
	// OK is returned by the Code function on a nil error. It is not a valid
	// code for an error.
	OK ErrorCode = gcerr.OK

	// Unknown means that the error could not be categorized.
	Unknown ErrorCode = gcerr.Unknown

	// NotFound means that the resource was not found.
	NotFound ErrorCode = gcerr.NotFound

	// AlreadyExists means that the resource exists, but it should not.
	AlreadyExists ErrorCode = gcerr.AlreadyExists

	// InvalidArgument means that a value given to a Go CDK API is incorrect.
	InvalidArgument ErrorCode = gcerr.InvalidArgument

	// Internal means that something unexpected happened. Internal errors always indicate
	// bugs in the Go CDK (or possibly the underlying service).
	Internal ErrorCode = gcerr.Internal

	// Unimplemented means that the feature is not implemented.
	Unimplemented ErrorCode = gcerr.Unimplemented

	// FailedPrecondition means that the system was in the wrong state.
	FailedPrecondition ErrorCode = gcerr.FailedPrecondition

	// PermissionDenied means that the caller does not have permission to execute the specified operation.
	PermissionDenied ErrorCode = gcerr.PermissionDenied

	// ResourceExhausted means that some resource has been exhausted, typically because a service resource limit
	// has been reached.
	ResourceExhausted ErrorCode = gcerr.ResourceExhausted

	// Canceled means that the operation was canceled.
	Canceled ErrorCode = gcerr.Canceled

	// DeadlinedExceeded means that the operation timed out.
	DeadlineExceeded ErrorCode = gcerr.DeadlineExceeded
)

func Code

func Code(err error) ErrorCode

Code returns the ErrorCode of err if it, or some error it wraps, is an *Error. If err is context.Canceled or context.DeadlineExceeded, or wraps one of those errors, it returns the Canceled or DeadlineExceeded codes, respectively. If err is nil, it returns the special code OK. Otherwise, it returns Unknown.

Jump to

Keyboard shortcuts

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