mirror of
https://github.com/taigrr/jety.git
synced 2026-04-02 03:19:03 -07:00
send back custom error
This commit is contained in:
3
jety.go
3
jety.go
@@ -181,6 +181,9 @@ func (c *ConfigManager) ReadInConfig() error {
|
|||||||
|
|
||||||
func readFile(filename string, fileType configType) (map[string]any, error) {
|
func readFile(filename string, fileType configType) (map[string]any, error) {
|
||||||
fileData := make(map[string]any)
|
fileData := make(map[string]any)
|
||||||
|
if _, err := os.Stat(filename); os.IsNotExist(err) {
|
||||||
|
return nil, ErrConfigFileNotFound
|
||||||
|
}
|
||||||
switch fileType {
|
switch fileType {
|
||||||
case ConfigTypeTOML:
|
case ConfigTypeTOML:
|
||||||
_, err := toml.DecodeFile(filename, &fileData)
|
_, err := toml.DecodeFile(filename, &fileData)
|
||||||
|
|||||||
Reference in New Issue
Block a user