This commit is contained in:
2024-11-18 16:28:45 +02:00
parent f0452ff9f7
commit 825c7e3391
34 changed files with 624 additions and 426 deletions

View File

@@ -2,27 +2,13 @@ package config
import "fmt"
// ConfigError represents a configuration error
type ConfigError struct {
Param string
Err error
}
func (e *ConfigError) Error() string {
return fmt.Sprintf("configuration error for %s: %v", e.Param, e.Err)
}
func (e *ConfigError) Unwrap() error {
return e.Err
}
// ValidationError represents a validation error
// ValidationError represents a config validation error
type ValidationError struct {
Param string
Value string
Reason string
}
func (e *ValidationError) Error() string {
func (e ValidationError) Error() string {
return fmt.Sprintf("invalid value '%s' for %s: %s", e.Value, e.Param, e.Reason)
}