Simplified CLI errors
This commit is contained in:
parent
a296ee8c94
commit
a562f521b6
6 changed files with 43 additions and 51 deletions
|
@ -1,13 +0,0 @@
|
|||
package errors
|
||||
|
||||
import "fmt"
|
||||
|
||||
// ExpectedCLIParameter error is created when a command line parameter is missing.
|
||||
type ExpectedCLIParameter struct {
|
||||
Parameter string
|
||||
}
|
||||
|
||||
// Error generates the string representation.
|
||||
func (err *ExpectedCLIParameter) Error() string {
|
||||
return fmt.Sprintf("Expected parameter '%s'", err.Parameter)
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
package errors
|
||||
|
||||
import "fmt"
|
||||
|
||||
// InvalidParameterValue error is created when a parameter has an invalid value.
|
||||
type InvalidParameterValue struct {
|
||||
Value string
|
||||
Parameter string
|
||||
}
|
||||
|
||||
// Error generates the string representation.
|
||||
func (err *InvalidParameterValue) Error() string {
|
||||
return fmt.Sprintf("Invalid value '%s' for parameter '%s'", err.Value, err.Parameter)
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
package errors
|
||||
|
||||
import "fmt"
|
||||
|
||||
// UnknownCLIParameter error is created when a command line parameter is not recognized.
|
||||
type UnknownCLIParameter struct {
|
||||
Parameter string
|
||||
}
|
||||
|
||||
// Error generates the string representation.
|
||||
func (err *UnknownCLIParameter) Error() string {
|
||||
return fmt.Sprintf("Unknown parameter '%s'", err.Parameter)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue