Documentation
¶
Index ¶
- func IsErrorCode(err error, code ErrorCode) bool
- type DomainError
- func ErrBusinessRule(rule string, violation string) *DomainError
- func ErrCSVExport(operation string, reason string) *DomainError
- func ErrCSVExportWithCause(operation string, reason string, err error) *DomainError
- func ErrCalculation(operation string, reason string) *DomainError
- func ErrCursorAPI(operation string, statusCode int, response string) *DomainError
- func ErrCursorAPIWithCause(operation string, err error) *DomainError
- func ErrCursorDatabase(operation string, path string) *DomainError
- func ErrCursorDatabaseWithCause(operation string, path string, err error) *DomainError
- func ErrCursorToken(reason string) *DomainError
- func ErrCursorTokenWithCause(reason string, err error) *DomainError
- func ErrDataCollection(source string, reason string) *DomainError
- func ErrDataCollectionWithCause(source string, reason string, err error) *DomainError
- func ErrFileOperation(operation string, path string, reason string) *DomainError
- func ErrFileOperationWithCause(operation string, path string, err error) *DomainError
- func ErrFilePermission(path string, requiredPermission string) *DomainError
- func ErrInvalidInput(field string, reason string) *DomainError
- func ErrInvalidState(entity string, currentState string, attemptedAction string) *DomainError
- func ErrNoDataAvailable(source string, timeRange string) *DomainError
- func ErrNotFound(resource string, id string) *DomainError
- func ErrPathTraversal(path string) *DomainError
- func ErrRepository(operation string, err error) *DomainError
- func ErrSystemDirectory(path string) *DomainError
- func ErrTimezone(operation string, reason string) *DomainError
- func ErrTimezoneDetection(fallbackLocation string) *DomainError
- func ErrTimezoneParse(timezoneName string, err error) *DomainError
- func ErrTimezoneWithCause(operation string, reason string, err error) *DomainError
- func NewDomainError(code ErrorCode, message string) *DomainError
- func NewDomainErrorWithCause(code ErrorCode, message string, err error) *DomainError
- type ErrorCode
- type Field
- type LogLevel
- type Logger
- type LoggerFactory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsErrorCode ¶
IsErrorCode checks if an error has a specific error code
Types ¶
type DomainError ¶
DomainError represents a domain-specific error
func ErrBusinessRule ¶
func ErrBusinessRule(rule string, violation string) *DomainError
ErrBusinessRule creates a business rule violation error
func ErrCSVExport ¶ added in v1.0.12
func ErrCSVExport(operation string, reason string) *DomainError
ErrCSVExport creates a CSV export error
func ErrCSVExportWithCause ¶ added in v1.0.12
func ErrCSVExportWithCause(operation string, reason string, err error) *DomainError
ErrCSVExportWithCause creates a CSV export error with cause
func ErrCalculation ¶
func ErrCalculation(operation string, reason string) *DomainError
ErrCalculation creates a calculation error
func ErrCursorAPI ¶
func ErrCursorAPI(operation string, statusCode int, response string) *DomainError
ErrCursorAPI creates a Cursor API error
func ErrCursorAPIWithCause ¶
func ErrCursorAPIWithCause(operation string, err error) *DomainError
ErrCursorAPIWithCause creates a Cursor API error with cause
func ErrCursorDatabase ¶
func ErrCursorDatabase(operation string, path string) *DomainError
ErrCursorDatabase creates a Cursor database error
func ErrCursorDatabaseWithCause ¶
func ErrCursorDatabaseWithCause(operation string, path string, err error) *DomainError
ErrCursorDatabaseWithCause creates a Cursor database error with cause
func ErrCursorToken ¶
func ErrCursorToken(reason string) *DomainError
ErrCursorToken creates a Cursor token error
func ErrCursorTokenWithCause ¶
func ErrCursorTokenWithCause(reason string, err error) *DomainError
ErrCursorTokenWithCause creates a Cursor token error with cause
func ErrDataCollection ¶ added in v1.0.12
func ErrDataCollection(source string, reason string) *DomainError
ErrDataCollection creates a data collection error
func ErrDataCollectionWithCause ¶ added in v1.0.12
func ErrDataCollectionWithCause(source string, reason string, err error) *DomainError
ErrDataCollectionWithCause creates a data collection error with cause
func ErrFileOperation ¶ added in v1.0.12
func ErrFileOperation(operation string, path string, reason string) *DomainError
ErrFileOperation creates a file operation error
func ErrFileOperationWithCause ¶ added in v1.0.12
func ErrFileOperationWithCause(operation string, path string, err error) *DomainError
ErrFileOperationWithCause creates a file operation error with cause
func ErrFilePermission ¶ added in v1.0.12
func ErrFilePermission(path string, requiredPermission string) *DomainError
ErrFilePermission creates a file permission error
func ErrInvalidInput ¶
func ErrInvalidInput(field string, reason string) *DomainError
ErrInvalidInput creates an invalid input error
func ErrInvalidState ¶
func ErrInvalidState(entity string, currentState string, attemptedAction string) *DomainError
ErrInvalidState creates an invalid state error
func ErrNoDataAvailable ¶ added in v1.0.12
func ErrNoDataAvailable(source string, timeRange string) *DomainError
ErrNoDataAvailable creates a no data available error
func ErrNotFound ¶
func ErrNotFound(resource string, id string) *DomainError
ErrNotFound creates a not found error
func ErrPathTraversal ¶ added in v1.0.12
func ErrPathTraversal(path string) *DomainError
ErrPathTraversal creates a path traversal error
func ErrRepository ¶
func ErrRepository(operation string, err error) *DomainError
ErrRepository creates a repository error
func ErrSystemDirectory ¶ added in v1.0.12
func ErrSystemDirectory(path string) *DomainError
ErrSystemDirectory creates a system directory access error
func ErrTimezone ¶
func ErrTimezone(operation string, reason string) *DomainError
ErrTimezone creates a timezone error
func ErrTimezoneDetection ¶
func ErrTimezoneDetection(fallbackLocation string) *DomainError
ErrTimezoneDetection creates a timezone detection error
func ErrTimezoneParse ¶
func ErrTimezoneParse(timezoneName string, err error) *DomainError
ErrTimezoneParse creates a timezone parsing error
func ErrTimezoneWithCause ¶
func ErrTimezoneWithCause(operation string, reason string, err error) *DomainError
ErrTimezoneWithCause creates a timezone error with cause
func NewDomainError ¶
func NewDomainError(code ErrorCode, message string) *DomainError
NewDomainError creates a new domain error
func NewDomainErrorWithCause ¶
func NewDomainErrorWithCause(code ErrorCode, message string, err error) *DomainError
NewDomainErrorWithCause creates a new domain error with an underlying cause
func (*DomainError) Error ¶
func (e *DomainError) Error() string
Error implements the error interface
func (*DomainError) Unwrap ¶
func (e *DomainError) Unwrap() error
Unwrap returns the underlying error
func (*DomainError) WithDetails ¶
func (e *DomainError) WithDetails(key string, value interface{}) *DomainError
WithDetails adds details to the error
type ErrorCode ¶
type ErrorCode string
ErrorCode represents the type of domain error
const ( // ErrCodeNotFound indicates that a requested resource was not found ErrCodeNotFound ErrorCode = "NOT_FOUND" // ErrCodeInvalidInput indicates that the input provided is invalid ErrCodeInvalidInput ErrorCode = "INVALID_INPUT" // ErrCodeBusinessRule indicates a business rule violation ErrCodeBusinessRule ErrorCode = "BUSINESS_RULE_VIOLATION" // ErrCodeCalculation indicates an error during calculation ErrCodeCalculation ErrorCode = "CALCULATION_ERROR" // ErrCodeRepository indicates a repository operation error ErrCodeRepository ErrorCode = "REPOSITORY_ERROR" // ErrCodeInvalidState indicates an invalid state transition ErrCodeInvalidState ErrorCode = "INVALID_STATE" // ErrCodeCursorToken indicates a Cursor token-related error ErrCodeCursorToken ErrorCode = "CURSOR_TOKEN_ERROR" // ErrCodeCursorAPI indicates a Cursor API communication error ErrCodeCursorAPI ErrorCode = "CURSOR_API_ERROR" // ErrCodeCursorDatabase indicates a Cursor database access error ErrCodeCursorDatabase ErrorCode = "CURSOR_DATABASE_ERROR" // ErrCodeTimezone indicates a timezone-related error ErrCodeTimezone ErrorCode = "TIMEZONE_ERROR" // ErrCodeCSVExport indicates a CSV export-related error ErrCodeCSVExport ErrorCode = "CSV_EXPORT_ERROR" // ErrCodeFileOperation indicates a file operation error ErrCodeFileOperation ErrorCode = "FILE_OPERATION_ERROR" // ErrCodeDataCollection indicates a data collection error ErrCodeDataCollection ErrorCode = "DATA_COLLECTION_ERROR" )
func GetErrorCode ¶
GetErrorCode extracts the error code from an error