1
0
mirror of https://github.com/fumiama/terasu-cloudflared.git synced 2026-06-10 05:04:15 +08:00

TUN-3527: More specific error for invalid YAML/JSON

This commit is contained in:
Adam Chalmers
2020-11-10 12:27:52 -06:00
parent 350a6f2bf5
commit 196762d9d3
3 changed files with 17 additions and 4 deletions

View File

@@ -1,11 +1,11 @@
package config
import (
"errors"
"os"
"github.com/cloudflare/cloudflared/logger"
"github.com/cloudflare/cloudflared/watcher"
"github.com/pkg/errors"
"gopkg.in/yaml.v2"
)
@@ -80,7 +80,7 @@ func readConfigFromPath(configPath string) (Root, error) {
var config Root
if err := yaml.NewDecoder(file).Decode(&config); err != nil {
return Root{}, err
return Root{}, errors.Wrap(err, "error parsing YAML in config file at "+configPath)
}
return config, nil