private/app/launcher: unwrap errors fully to avoid hiding cause #4783
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.
Before this commit, when a key was removed from the struct that defines available configuration option for the toml file for a given application such as the scion-dispatcher, it would fail without reporting what key is present when it should be removed from the config file, as follows:
error: loading config from file {file=/foo.toml}: strict mode: fields in the document are missing in the target structAfter this commit it will fail more informatively as follows:
error: loading config from file {file=/foo.toml}: strict mode: fields in the document are missing in the target struct &toml.StrictMissingError{Errors:[]t oml.DecodeError{toml.DecodeError{message:"missing field", line:4, column:1, key:toml.Key{"general", "reconnect_to_dispatcher"}, human:"1| [general]\n2| config_dir = \"/etc/scion\"\n3| id = \"sd\"\n4| reconnect_to_dispatcher = true\n | ~~~~~~~~~~~~~~~~~~~~~ ~~ missing field\n5|\n6| [log.console]\n7| level = \"info\""}}}You can see the reason for the failure is the presence of the "reconnect_to_dispatcher" key, which no longer exists in 0.12, but did in 0.11.
I do not think this PR is necessarily the best way to accomplish or format this, but it was useful for me and is a good way to discuss the issue. If anyone else has a better idea, then please contribute it!