Documentation
¶
Index ¶
- Constants
- func AuthError(msg string, args ...interface{}) error
- func ChannelNotFoundError(channel string) error
- func ClassifySlackError(err error) int
- func ConfigError(msg string, args ...interface{}) error
- func Execute(rootCmd *cobra.Command)
- func HandleCommandError(cmd *cobra.Command, err error) error
- func IsMissingScopeError(err error) bool
- func IsNotFoundError(err error) bool
- func MissingScopeError(operation string, requiredScopes ...string) error
- func NetworkError(msg string, args ...interface{}) error
- func NotFoundError(resourceType, identifier string, hint string) error
- func RateLimitError(retryAfter string) error
- func TimeoutError(msg string, args ...interface{}) error
- func UserNotFoundError(user string) error
- type ErrorWithExitCode
Constants ¶
const ( ExitSuccess = 0 // Success ExitGeneral = 1 // General error ExitConfig = 2 // Configuration error (missing config, invalid tokens) ExitAuth = 3 // Authentication error (invalid/expired tokens) ExitRateLimit = 4 // Rate limit exceeded ExitNetwork = 5 // Network error ExitPermission = 6 // Permission denied (missing scopes) ExitNotFound = 7 // Resource not found (channel, user, message) ExitTimeout = 124 )
Exit codes as defined in docs/DESIGN.md section 8.1
Variables ¶
This section is empty.
Functions ¶
func ChannelNotFoundError ¶
ChannelNotFoundError creates a specific error for missing channels with helpful hints.
func ClassifySlackError ¶
ClassifySlackError examines a Slack API error and returns an appropriate exit code.
func ConfigError ¶
ConfigError creates a configuration-related error.
func Execute ¶
Execute runs a cobra command and exits with the appropriate code. This should be used in main.go to ensure proper exit codes.
func HandleCommandError ¶
HandleCommandError processes an error from a command and sets the appropriate exit code. It should be called in the RunE function of cobra commands.
func IsMissingScopeError ¶
IsMissingScopeError checks if an error is due to missing OAuth scopes.
func IsNotFoundError ¶
IsNotFoundError checks if an error is a not-found error.
func MissingScopeError ¶
MissingScopeError creates a user-friendly error for missing OAuth scopes.
func NetworkError ¶
NetworkError creates a network-related error.
func NotFoundError ¶
NotFoundError creates a user-friendly error for missing resources.
func RateLimitError ¶
RateLimitError creates a rate limit error with retry information.
func TimeoutError ¶ added in v0.1.9
TimeoutError creates an error for commands that intentionally waited and timed out.
func UserNotFoundError ¶
UserNotFoundError creates a specific error for missing users with helpful hints.
Types ¶
type ErrorWithExitCode ¶
ErrorWithExitCode wraps an error with a specific exit code.
func NewErrorWithCode ¶
func NewErrorWithCode(code int, format string, args ...interface{}) *ErrorWithExitCode
NewErrorWithCode creates an error with a specific exit code.
func WrapWithCode ¶
func WrapWithCode(code int, err error, format string, args ...interface{}) *ErrorWithExitCode
WrapWithCode wraps an existing error with an exit code.
func (*ErrorWithExitCode) Error ¶
func (e *ErrorWithExitCode) Error() string
func (*ErrorWithExitCode) Unwrap ¶
func (e *ErrorWithExitCode) Unwrap() error