style: format code with gofmt
This commit is contained in:
@@ -10,17 +10,17 @@ import (
|
||||
type ErrorCategory string
|
||||
|
||||
const (
|
||||
CategoryNetwork ErrorCategory = "NETWORK" // RPC, DNS, connection issues
|
||||
CategoryParsing ErrorCategory = "PARSING" // ABI decoding, transaction parsing
|
||||
CategoryValidation ErrorCategory = "VALIDATION" // Input validation, data validation
|
||||
CategoryExecution ErrorCategory = "EXECUTION" // Transaction execution, contract calls
|
||||
CategoryNetwork ErrorCategory = "NETWORK" // RPC, DNS, connection issues
|
||||
CategoryParsing ErrorCategory = "PARSING" // ABI decoding, transaction parsing
|
||||
CategoryValidation ErrorCategory = "VALIDATION" // Input validation, data validation
|
||||
CategoryExecution ErrorCategory = "EXECUTION" // Transaction execution, contract calls
|
||||
CategoryConfiguration ErrorCategory = "CONFIGURATION" // Config loading, invalid settings
|
||||
CategoryDatabase ErrorCategory = "DATABASE" // Database operations
|
||||
CategorySecurity ErrorCategory = "SECURITY" // Security violations, unauthorized access
|
||||
CategoryMath ErrorCategory = "MATH" // Arithmetic errors, overflow/underflow
|
||||
CategoryInternal ErrorCategory = "INTERNAL" // Internal logic errors, unexpected state
|
||||
CategoryExternal ErrorCategory = "EXTERNAL" // External service failures
|
||||
CategoryUnknown ErrorCategory = "UNKNOWN" // Uncategorized errors
|
||||
CategoryDatabase ErrorCategory = "DATABASE" // Database operations
|
||||
CategorySecurity ErrorCategory = "SECURITY" // Security violations, unauthorized access
|
||||
CategoryMath ErrorCategory = "MATH" // Arithmetic errors, overflow/underflow
|
||||
CategoryInternal ErrorCategory = "INTERNAL" // Internal logic errors, unexpected state
|
||||
CategoryExternal ErrorCategory = "EXTERNAL" // External service failures
|
||||
CategoryUnknown ErrorCategory = "UNKNOWN" // Uncategorized errors
|
||||
)
|
||||
|
||||
// ErrorSeverity represents how critical an error is
|
||||
@@ -49,12 +49,12 @@ type StructuredError struct {
|
||||
Package string // Go package where error occurred
|
||||
|
||||
// Context
|
||||
Reason string // Why this error occurred (root cause)
|
||||
Action string // What the code was trying to do when it failed
|
||||
Impact string // Impact of this error on the system
|
||||
Suggestion string // Suggested fix or next steps
|
||||
Details map[string]interface{} // Additional structured context
|
||||
UnderlyingErr error // Original error if wrapping
|
||||
Reason string // Why this error occurred (root cause)
|
||||
Action string // What the code was trying to do when it failed
|
||||
Impact string // Impact of this error on the system
|
||||
Suggestion string // Suggested fix or next steps
|
||||
Details map[string]interface{} // Additional structured context
|
||||
UnderlyingErr error // Original error if wrapping
|
||||
|
||||
// Metadata
|
||||
Timestamp time.Time // When the error occurred
|
||||
@@ -168,9 +168,9 @@ func (e *StructuredError) Wrap(err error) *StructuredError {
|
||||
func (e *StructuredError) FormatForLogging() string {
|
||||
result := fmt.Sprintf(
|
||||
"[%s] %s/%s: %s\n"+
|
||||
" Origin: %s:%d (%s)\n"+
|
||||
" ErrorID: %s\n"+
|
||||
" Timestamp: %s\n",
|
||||
" Origin: %s:%d (%s)\n"+
|
||||
" ErrorID: %s\n"+
|
||||
" Timestamp: %s\n",
|
||||
e.ErrorID,
|
||||
e.Category,
|
||||
e.Severity,
|
||||
|
||||
Reference in New Issue
Block a user