fix: Also report toml loading failures with --watch #214
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The hot_reload crate (used for loading config.toml) in
--watch
mode does not report the ReloaderError we give, only that reloading failed with generic message "Failed to reload watch target" in WARN level. But at the same time, WARN level logs of external crates are not logged by default => no log message when broken config and --watch is active.So I changed it to report our own log message more in line with non-watch mode together with the error detail about why loading failed. I changed it from ERROR to WARN because it is non-fatal in the sense that if you fix the configuration it can still recover. But of course if it is the first time the config is being loaded it will block startup, so yeah feel free to comment on that.
Example log:
Steps to reproduce:
listen_port = true
which has wrong datatype.cargo run -- --config config.toml --watch
Current implementation will keep re-reporting the problem at 15 second intervals until the error has been fixed.