refactor: use LogFailWithError to allow a unified exit code for golang commands when the app is missing
This commit is contained in:
@@ -515,10 +515,17 @@ func isValidAppNameOld(appName string) error {
|
||||
return errors.New("App name must begin with lowercase alphanumeric character, and cannot include uppercase characters, or colons")
|
||||
}
|
||||
|
||||
// AppDoesNotExist wraps error to include the app name
|
||||
// and is used to distinguish between a normal error and an error
|
||||
// where the app is missing
|
||||
type AppDoesNotExist struct {
|
||||
appName string
|
||||
}
|
||||
|
||||
func (err *AppDoesNotExist) ExitCode() int {
|
||||
return 20
|
||||
}
|
||||
|
||||
func (err *AppDoesNotExist) Error() string {
|
||||
return fmt.Sprintf("App %s does not exist", err.appName)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user