Documentation
¶
Index ¶
- func Log(ctx context.Context, err error)
- func LogWithLogger(logger *slog.Logger, ctx context.Context, err error)
- func NewApiError(httpResp *http.Response, err error) error
- func NewCommandError(commandName string, err error) error
- func NewToolError(toolName string, err error) error
- type ApiError
- type CommandError
- type ToolError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCommandError ¶
func NewToolError ¶
Types ¶
type ApiError ¶
type ApiError struct {
// OriginalError is the underlying error that occurred
OriginalError error
// StatusCode is the HTTP status code from the response (e.g., 404, 500)
StatusCode int
// Status is the HTTP status text (e.g., "Not Found", "Internal Server Error")
Status string
// Method is the HTTP method used in the request (e.g., "GET", "POST")
Method string
// URL is the full URL of the request that caused the error
URL string
// ResponseBody contains the raw response body from the API
ResponseBody string
}
ApiError represents a structured API error with HTTP response details. It wraps the original error and enriches it with HTTP context including status codes, request methods, and URLs for better debugging and logging.
ApiError implements the error interface and supports error unwrapping, allowing it to integrate with Go's standard error handling patterns.
type CommandError ¶
CommandError represents an error that occurred within a specific cobra command
func (*CommandError) Error ¶
func (e *CommandError) Error() string
func (*CommandError) Unwrap ¶
func (e *CommandError) Unwrap() error
Click to show internal directories.
Click to hide internal directories.