{"modulePath":"github.com/PhilipKram/gitlab-cli","version":"v0.7.2","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package errors\n\n## Functions\n\n```go\nfunc As(err error, target interface{}) bool\n```\nAs is a convenience wrapper around errors.As from the standard library. It finds the first error in err's chain that matches target's type.\n\n```go\nfunc IsAPIError(err error) bool\n```\nIsAPIError checks if an error is or wraps an APIError.\n\n```go\nfunc IsAuthError(err error) bool\n```\nIsAuthError checks if an error is or wraps an AuthError.\n\n```go\nfunc IsNetworkError(err error) bool\n```\nIsNetworkError checks if an error is or wraps a NetworkError.\n\n```go\nfunc IsVerboseMode() bool\n```\nIsVerboseMode returns whether verbose mode is enabled.\n\n```go\nfunc IsVersionError(err error) bool\n```\nIsVersionError checks if an error is or wraps a VersionError.\n\n```go\nfunc NewLoggingHTTPClient() *http.Client\n```\nNewLoggingHTTPClient creates an HTTP client that logs requests/responses in verbose mode.\n\n```go\nfunc SetVerboseMode(enabled bool)\n```\nSetVerboseMode enables or disables verbose error output.\n\n```go\nfunc SuggestForAuth(statusCode int, host string) string\n```\nSuggestForAuth returns an actionable suggestion for authentication errors.\n\n```go\nfunc SuggestForNetwork(host string) string\n```\nSuggestForNetwork returns an actionable suggestion for network errors.\n\n```go\nfunc SuggestForStatusCode(statusCode int) string\n```\nSuggestForStatusCode returns an actionable suggestion based on HTTP status code.\n\n```go\nfunc WrapAPIError(err error, method, url string, statusCode int) error\n```\nWrapAPIError wraps an existing error with API context. If err is nil, returns nil. If err is already an APIError, returns it unchanged.\n\n## Types\n\n```go\ntype APIError struct {\n\t// Method is the HTTP method (GET, POST, PUT, DELETE, etc.)\n\tMethod string\n\t// URL is the full request URL that failed\n\tURL string\n\t// StatusCode is the HTTP status code from the response\n\tStatusCode int\n\t// Message is the error message from the API or a descriptive error\n\tMessage string\n\t// Suggestion provides actionable guidance to resolve the error\n\tSuggestion string\n\t// Err is the underlying error that caused this API error\n\tErr error\n}\n```\nAPIError represents an error from a GitLab API request with detailed context.\n\n```go\nfunc NewAPIError(method, url string, statusCode int, message string, err error) *APIError\n```\nNewAPIError creates a new APIError with the given details. The suggestion is automatically generated from the status code if not provided.\n\n```go\nfunc (e *APIError) Error() string\n```\nError implements the error interface.\n\n```go\nfunc (e *APIError) ErrorCode() string\n```\nErrorCode returns the error code for this APIError.\n\n```go\nfunc (e *APIError) ErrorDetails() map[string]interface{}\n```\nErrorDetails returns structured details for JSON error formatting.\n\n```go\nfunc (e *APIError) Unwrap() error\n```\nUnwrap returns the underlying error.\n\n```go\ntype AuthError struct {\n\t// Host is the GitLab host where authentication failed\n\tHost string\n\t// Method is the HTTP method (GET, POST, PUT, DELETE, etc.)\n\tMethod string\n\t// URL is the full request URL that failed\n\tURL string\n\t// StatusCode is the HTTP status code (typically 401 or 403)\n\tStatusCode int\n\t// Message is a descriptive error message\n\tMessage string\n\t// Suggestion provides actionable guidance to resolve the auth issue\n\tSuggestion string\n\t// Err is the underlying error\n\tErr error\n}\n```\nAuthError represents an authentication or authorization error.\n\n```go\nfunc NewAuthError(host, method, url string, statusCode int, message string, err error) *AuthError\n```\nNewAuthError creates a new AuthError with the given details. The suggestion is automatically generated from the status code and host if not provided.\n\n```go\nfunc (e *AuthError) Error() string\n```\nError implements the error interface.\n\n```go\nfunc (e *AuthError) ErrorCode() string\n```\nErrorCode returns the error code for this AuthError.\n\n```go\nfunc (e *AuthError) ErrorDetails() map[string]interface{}\n```\nErrorDetails returns structured details for JSON error formatting.\n\n```go\nfunc (e *AuthError) Unwrap() error\n```\nUnwrap returns the underlying error.\n\n```go\ntype NetworkError struct {\n\t// Host is the remote host that could not be reached\n\tHost string\n\t// URL is the full request URL that failed\n\tURL string\n\t// Message is a descriptive error message\n\tMessage string\n\t// Suggestion provides actionable guidance to resolve the network issue\n\tSuggestion string\n\t// Err is the underlying error\n\tErr error\n}\n```\nNetworkError represents a network connectivity error.\n\n```go\nfunc NewNetworkError(host, url, message string, err error) *NetworkError\n```\nNewNetworkError creates a new NetworkError with the given details. The suggestion is automatically generated from the host if not provided.\n\n```go\nfunc (e *NetworkError) Error() string\n```\nError implements the error interface.\n\n```go\nfunc (e *NetworkError) ErrorCode() string\n```\nErrorCode returns the error code for this NetworkError.\n\n```go\nfunc (e *NetworkError) ErrorDetails() map[string]interface{}\n```\nErrorDetails returns structured details for JSON error formatting.\n\n```go\nfunc (e *NetworkError) Unwrap() error\n```\nUnwrap returns the underlying error.\n\n```go\ntype VersionError struct {\n\t// RequiredVersion is the minimum GitLab version required\n\tRequiredVersion string\n\t// ActualVersion is the detected GitLab version\n\tActualVersion string\n\t// Feature is the feature or operation that requires the minimum version\n\tFeature string\n\t// Message is a descriptive error message\n\tMessage string\n\t// Suggestion provides actionable guidance to resolve the version issue\n\tSuggestion string\n\t// Err is the underlying error\n\tErr error\n}\n```\nVersionError represents a GitLab API version mismatch error.\n\n```go\nfunc NewVersionError(requiredVersion, actualVersion, feature, message string, err error) *VersionError\n```\nNewVersionError creates a new VersionError with the given details.\n\n```go\nfunc (e *VersionError) Error() string\n```\nError implements the error interface.\n\n```go\nfunc (e *VersionError) Unwrap() error\n```\nUnwrap returns the underlying error.\n\n","path":"github.com/PhilipKram/gitlab-cli/internal/errors","name":"errors","synopsis":"","isRedistributable":true}
