style: format code with gofmt

This commit is contained in:
Krypto Kajun
2025-11-08 10:37:52 -06:00
parent 8cba462024
commit ae4abc5b5c
32 changed files with 9207 additions and 5843 deletions

View File

@@ -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,