mirror of https://github.com/lightninglabs/loop
Improve error handling of config file
This makes two changes to handling of errors when configuration file could not be loaded: 1. Only NotFound errors are considered OK - access errors and other FS issues are now treated as fatal. 2. Failing to load config file specified explicitly via `--configfile` option is alway a fatal error. Rationale: If the configfile was specified explicitly then it indicates the user really wishes to load it. While the user could want it to be optionally loaded for extra configuration options, this can be accomplished using an empty file. If the config file was not specified explicitly then its' path was computed from loop directory. If the file is inaccessible due to permissions or other FS errors it's nearly certain other following operations will fail as well. Failing early with a clear message is thus beneficial. This still leaves room for uncaught user error (e.g. mistakenly naming config file inside loop dir as `loop.conf` instead of `loopd.conf`) but it's greatly reduced and such error should be easier to identify. (Indirectly) closes #412pull/413/head
parent
63f34ec45c
commit
84582bbb88
Loading…
Reference in New Issue