29 lines
555 B
Go
29 lines
555 B
Go
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
|
|
type ValidationError struct {
|
|
Param string
|
|
Value string
|
|
Reason string
|
|
}
|
|
|
|
func (e *ValidationError) Error() string {
|
|
return fmt.Sprintf("invalid value '%s' for %s: %s", e.Value, e.Param, e.Reason)
|
|
}
|