mirror of
https://github.com/cupcakearmy/autorestic.git
synced 2024-11-05 13:14:48 +01:00
better error handling
This commit is contained in:
parent
8a713e497d
commit
8b74a98836
@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [1.5.8] - 2022-03-18
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Better error handling for bad config files.
|
||||||
|
|
||||||
## [1.5.7] - 2022-03-11
|
## [1.5.7] - 2022-03-11
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
@ -17,7 +17,7 @@ import (
|
|||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
)
|
)
|
||||||
|
|
||||||
const VERSION = "1.5.7"
|
const VERSION = "1.5.8"
|
||||||
|
|
||||||
type OptionMap map[string][]interface{}
|
type OptionMap map[string][]interface{}
|
||||||
type Options map[string]OptionMap
|
type Options map[string]OptionMap
|
||||||
@ -60,11 +60,16 @@ func GetConfig() *Config {
|
|||||||
colors.Faint.Println("Using env:\t", envFile)
|
colors.Faint.Println("Using env:\t", envFile)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
text := err.Error()
|
||||||
|
if strings.Contains(text, "no such file or directory") {
|
||||||
cfgFileName := ".autorestic"
|
cfgFileName := ".autorestic"
|
||||||
colors.Error.Println(
|
colors.Error.Println(
|
||||||
fmt.Sprintf(
|
fmt.Sprintf(
|
||||||
"cannot find configuration file '%s.yml' or '%s.yaml'.",
|
"cannot find configuration file '%s.yml' or '%s.yaml'.",
|
||||||
cfgFileName, cfgFileName))
|
cfgFileName, cfgFileName))
|
||||||
|
} else {
|
||||||
|
colors.Error.Println("could not load config file\n" + text)
|
||||||
|
}
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user