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

errors

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ZonalAllocationFailedAzErrorCode is an Azure error code indicating that there is insufficient capacity in the target zone.
	ZonalAllocationFailedAzErrorCode = "ZonalAllocationFailed"
	// SkuNotAvailableAzErrorCode is an Azure error code that indicates the specific resource SKU (e.g., a virtual machine size) selected isn't currently available.
	SkuNotAvailableAzErrorCode = "SkuNotAvailable"
	// AllocationFailedAzErrorCode is an Azure error code that indicates that there is insufficient capacity in the region
	AllocationFailedAzErrorCode = "AllocationFailed"
	// ResourceQuotaExceededAzErrorCode is an Azure error code that indicates that the quota has exceeded for a subscription, resource group, or error code
	ResourceQuotaExceededAzErrorCode = "ResourceQuotaExceeded"
	// OperationNotAllowedAzErrorCode is an Azure error code that indicates that the operation isn't allowed.
	OperationNotAllowedAzErrorCode = "OperationNotAllowed"
	// BadRequestAzErrorCode is an Azure error code that indicates that the request is invalid.
	BadRequestAzErrorCode = "BadRequest"
	// CorrelationRequestIDAzHeaderKey is the Azure API response header key whose value is a request correlation ID.
	CorrelationRequestIDAzHeaderKey = "x-ms-correlation-request-id"
	// RequestIDAzHeaderKey is the Azure API response header key whose value is the request ID.
	RequestIDAzHeaderKey = "x-ms-request-id"
	// ErrorCodeAzHeaderKey is the Azure API response header key whose value is the underline error code as set by the server.
	ErrorCodeAzHeaderKey = "x-ms-error-code"
	// ClientRequestIDAzHeaderKey is the Azure API response header key whose value is the client request ID.
	ClientRequestIDAzHeaderKey = "x-ms-client-request-id"
)

Variables

View Source
var (

	// ExceedingQuotaRegex is a regex pattern to identify if an "OperationNotAllowed" error is caused by exceeding quota limits.
	ExceedingQuotaRegex = regexp.MustCompile(`(?i)exceeding.*quota`)
	// NotSupportedRegex is a regex pattern to identify if a "BadRequest" error is caused by an unsupported operation or resource.
	NotSupportedRegex = regexp.MustCompile(`(?i)not\s+supported`)
)

Functions

func GetMatchingErrorCode

func GetMatchingErrorCode(err error) codes.Code

GetMatchingErrorCode gets a matching codes.Code for the given azure error code.

func IsNotFoundAzAPIError

func IsNotFoundAzAPIError(err error) bool

IsNotFoundAzAPIError checks if error is an AZ API error and if it is a 404 response code.

func LogAzAPIError

func LogAzAPIError(err error, format string, v ...any)

LogAzAPIError collects additional information from AZ response and logs it as part of the error log message.

Types

This section is empty.

Jump to

Keyboard shortcuts

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