mirror of
https://github.com/aykhans/dodo.git
synced 2025-09-06 11:04:22 +00:00
refactor config file type
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package parser
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
"net/url"
|
||||
@@ -173,17 +172,6 @@ func (parser ConfigCLIParser) Parse() (*config.Config, error) {
|
||||
configFileParsed, err := types.ParseConfigFile(configFile)
|
||||
|
||||
_ = utils.HandleErrorOrDie(err,
|
||||
utils.OnSentinelError(types.ErrConfigFileExtensionNotFound, func(err error) error {
|
||||
fieldParseErrors = append(
|
||||
fieldParseErrors,
|
||||
*types.NewFieldParseError(
|
||||
fmt.Sprintf("config-file[%d]", i),
|
||||
configFile,
|
||||
errors.New("file extension not found"),
|
||||
),
|
||||
)
|
||||
return nil
|
||||
}),
|
||||
utils.OnCustomError(func(err types.RemoteConfigFileParseError) error {
|
||||
fieldParseErrors = append(
|
||||
fieldParseErrors,
|
||||
@@ -195,17 +183,6 @@ func (parser ConfigCLIParser) Parse() (*config.Config, error) {
|
||||
)
|
||||
return nil
|
||||
}),
|
||||
utils.OnCustomError(func(err types.UnknownConfigFileTypeError) error {
|
||||
fieldParseErrors = append(
|
||||
fieldParseErrors,
|
||||
*types.NewFieldParseError(
|
||||
fmt.Sprintf("config-file[%d]", i),
|
||||
configFile,
|
||||
fmt.Errorf("file type '%s' not supported (supported types: %s)", err.Type, types.ConfigFileTypeYAML),
|
||||
),
|
||||
)
|
||||
return nil
|
||||
}),
|
||||
)
|
||||
|
||||
if err == nil {
|
||||
|
Reference in New Issue
Block a user