mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-25 10:01:28 +00:00
Config loader returns error instead of directly panic (#80)
This commit is contained in:
parent
fe445f8e1a
commit
19ce0e99a5
|
@ -22,9 +22,13 @@ func init() {
|
|||
for i, arg := range v {
|
||||
newError("Reading config: ", arg).AtInfo().WriteToLog()
|
||||
r, err := confloader.LoadConfig(arg)
|
||||
common.Must(err)
|
||||
if err != nil {
|
||||
return nil, newError("failed to read config: ", arg).Base(err)
|
||||
}
|
||||
c, err := serial.DecodeJSONConfig(r)
|
||||
common.Must(err)
|
||||
if err != nil {
|
||||
return nil, newError("failed to decode config: ", arg).Base(err)
|
||||
}
|
||||
if i == 0 {
|
||||
// This ensure even if the muti-json parser do not support a setting,
|
||||
// It is still respected automatically for the first configure file
|
||||
|
|
|
@ -164,7 +164,7 @@ func startXray() (core.Server, error) {
|
|||
|
||||
config, err := core.LoadConfig(getConfigFormat(), configFiles[0], configFiles)
|
||||
if err != nil {
|
||||
return nil, newError("failed to read config files: [", configFiles.String(), "]").Base(err)
|
||||
return nil, newError("failed to load config files: [", configFiles.String(), "]").Base(err)
|
||||
}
|
||||
|
||||
server, err := core.New(config)
|
||||
|
|
Loading…
Reference in a new issue