mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-11 16:14:05 -08:00
25 lines
490 B
Go
25 lines
490 B
Go
|
package godo
|
||
|
|
||
|
import "fmt"
|
||
|
|
||
|
// ArgError is an error that represents an error with an input to godo. It
|
||
|
// identifies the argument and the cause (if possible).
|
||
|
type ArgError struct {
|
||
|
arg string
|
||
|
reason string
|
||
|
}
|
||
|
|
||
|
var _ error = &ArgError{}
|
||
|
|
||
|
// NewArgError creates an InputError.
|
||
|
func NewArgError(arg, reason string) *ArgError {
|
||
|
return &ArgError{
|
||
|
arg: arg,
|
||
|
reason: reason,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (e *ArgError) Error() string {
|
||
|
return fmt.Sprintf("%s is invalid because %s", e.arg, e.reason)
|
||
|
}
|