Documentation
¶
Overview ¶
Package errortypes provides error types and handling for ProjectMemory.
Index ¶
- func IsDatabaseError(err error) bool
- func IsNetworkError(err error) bool
- func IsPermissionError(err error) bool
- func IsValidationError(err error) bool
- func LogError(logger *slog.Logger, err error)
- type AppError
- func APIError(err error, message string) *AppError
- func ConfigError(err error, message string) *AppError
- func DatabaseError(err error, message string) *AppError
- func ExternalError(err error, message string) *AppError
- func InternalError(err error, message string) *AppError
- func NetworkError(err error, message string) *AppError
- func PermissionError(err error, message string) *AppError
- func ValidationError(err error, message string) *AppError
- type ErrorType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsDatabaseError ¶ added in v0.1.4
IsDatabaseError checks if an error is a database error
func IsNetworkError ¶ added in v0.1.4
IsNetworkError checks if an error is a network error
func IsPermissionError ¶ added in v0.1.4
IsPermissionError checks if an error is a permission error
func IsValidationError ¶ added in v0.1.4
IsValidationError checks if an error is a validation error
Types ¶
type AppError ¶ added in v0.1.4
type AppError struct {
Err error
Type ErrorType
Message string
StackInfo string
Fields map[string]interface{}
}
AppError represents an application error with context
func ConfigError ¶
ConfigError creates a new configuration error
func DatabaseError ¶
DatabaseError creates a new database error
func ExternalError ¶
ExternalError creates a new external error
func InternalError ¶
InternalError creates a new internal error
func NetworkError ¶
NetworkError creates a new network error
func PermissionError ¶
PermissionError creates a new permission error
func ValidationError ¶
ValidationError creates a new validation error
func (*AppError) Unwrap ¶ added in v0.1.4
Unwrap unwraps the error to support errors.Is and errors.As
func (*AppError) WithField ¶ added in v0.1.4
WithField adds a field to the error for additional context
func (*AppError) WithFields ¶ added in v0.1.4
WithFields adds multiple fields to the error for additional context
type ErrorType ¶
type ErrorType string
ErrorType represents the type of error that occurred
const ( ErrorTypeValidation ErrorType = "validation" ErrorTypePermission ErrorType = "permission" ErrorTypeDatabase ErrorType = "database" ErrorTypeNetwork ErrorType = "network" ErrorTypeAPI ErrorType = "api" ErrorTypeConfig ErrorType = "config" ErrorTypeInternal ErrorType = "internal" ErrorTypeExternal ErrorType = "external" )
Error types