Documentation
¶
Index ¶
- func GetContext(err error) map[string]interface{}
- func IsType(err error, errType ErrorType) bool
- type ErrorType
- type S9sError
- func Config(message string) *S9sError
- func Configf(format string, args ...interface{}) *S9sError
- func Forbidden(message string) *S9sError
- func Internal(message string) *S9sError
- func Internalf(format string, args ...interface{}) *S9sError
- func Invalid(field, reason string) *S9sError
- func Invalidf(format string, args ...interface{}) *S9sError
- func Network(message string) *S9sError
- func New(errType ErrorType, message string) *S9sError
- func Newf(errType ErrorType, format string, args ...interface{}) *S9sError
- func NotFound(resource string) *S9sError
- func NotFoundf(format string, args ...interface{}) *S9sError
- func Timeout(operation string) *S9sError
- func Unauthorized(message string) *S9sError
- func Wrap(err error, errType ErrorType, message string) *S9sError
- func Wrapf(err error, errType ErrorType, format string, args ...interface{}) *S9sError
- type StackFrame
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetContext ¶
GetContext returns the error context
Types ¶
type ErrorType ¶
type ErrorType string
ErrorType represents the type of error
const ( // ErrorTypeUnknown is for unknown errors ErrorTypeUnknown ErrorType = "unknown" // ErrorTypeValidation is for validation errors ErrorTypeValidation ErrorType = "validation" // ErrorTypeNotFound is for resource not found errors ErrorTypeNotFound ErrorType = "not_found" // ErrorTypeConflict is for conflict errors ErrorTypeConflict ErrorType = "conflict" // ErrorTypeInternal is for internal server errors ErrorTypeInternal ErrorType = "internal" // ErrorTypeTimeout is for timeout errors ErrorTypeTimeout ErrorType = "timeout" // ErrorTypeAuthentication is for authentication errors ErrorTypeAuthentication ErrorType = "authentication" // ErrorTypeAuthorization is for authorization errors ErrorTypeAuthorization ErrorType = "authorization" // ErrorTypeNetwork is for network-related errors ErrorTypeNetwork ErrorType = "network" // ErrorTypeConfiguration is for configuration errors ErrorTypeConfiguration ErrorType = "configuration" )
type S9sError ¶
type S9sError struct {
Type ErrorType
Message string
Cause error
Context map[string]interface{}
Stack []StackFrame
}
S9sError represents a structured error with additional context
func Unauthorized ¶
Unauthorized creates an authentication error
func (*S9sError) WithContext ¶
WithContext adds context to the error
type StackFrame ¶
StackFrame represents a single frame in the call stack
Click to show internal directories.
Click to hide internal directories.