Documentation
¶
Index ¶
- func IsForbidden(err error) bool
- func IsNotFound(err error) bool
- func IsRateLimit(err error) bool
- func IsUnauthorized(err error) bool
- type BBError
- func ConfigError(message string) *BBError
- func Forbidden(action string) *BBError
- func GitError(operation string, err error) *BBError
- func InvalidInput(field, reason string) *BBError
- func NetworkError(err error) *BBError
- func New(message string) *BBError
- func NotFound(resourceType, identifier string) *BBError
- func ParseAPIError(resp *http.Response, body []byte) *BBError
- func RateLimit(resetTime string) *BBError
- func Unauthorized(message string) *BBError
- func WithSuggestion(err error, suggestion string) *BBError
- func Wrap(err error, message string) *BBError
- type BitbucketAPIError
- type Error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsForbidden ¶
IsForbidden checks if an error is a 403 Forbidden error.
func IsNotFound ¶
IsNotFound checks if an error is a 404 Not Found error.
func IsRateLimit ¶
IsRateLimit checks if an error is a 429 Rate Limit error.
func IsUnauthorized ¶
IsUnauthorized checks if an error is a 401 Unauthorized error.
Types ¶
type BBError ¶
type BBError struct {
// Message is the human-readable description of what went wrong
Message string
// Suggestion provides actionable guidance for resolving the error
Suggestion string
// StatusCode is the HTTP status code if this is an API error (0 if not applicable)
StatusCode int
// Err is the underlying error that caused this error (can be nil)
Err error
}
BBError represents a structured error with user-friendly messages and suggestions. It provides context about what went wrong and actionable steps to resolve the issue.
func ConfigError ¶
ConfigError creates an error for configuration-related failures.
func InvalidInput ¶
InvalidInput creates an error for invalid user input.
func NetworkError ¶
NetworkError creates an error for network-related failures.
func ParseAPIError ¶
ParseAPIError parses an HTTP response and creates an appropriate BBError. It extracts error details from the Bitbucket API JSON response and rate limit headers.
func Unauthorized ¶
Unauthorized creates an error for authentication failures (401).
func WithSuggestion ¶
WithSuggestion adds a suggestion to an existing BBError or creates a new one.
type BitbucketAPIError ¶
type BitbucketAPIError struct {
Type string `json:"type"`
Error Error `json:"error"`
Message string `json:"message,omitempty"`
}
BitbucketAPIError represents the JSON error response from the Bitbucket API. See: https://developer.atlassian.com/cloud/bitbucket/rest/intro/#error-responses