Commit 12b58c6
committed
private/app/launcher: unwrap errors fully to avoid hiding cause
As an example, 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 struct
After 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 exists1 parent 4ab4513 commit 12b58c6
2 files changed
+4
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
49 | | - | |
| 50 | + | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
76 | | - | |
| 77 | + | |
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
| |||
0 commit comments