Commit f34cdc3
authored
parser/metadecoder: Improve errors for non-map XML root values
Previously, the XML decoder would panic when encountering a root element with
a non-map value due to an unsafe type assertion.
The fix adds proper type checking before the map conversion and provides
clear error messages to help users identify and fix invalid XML structures.
Example error for invalid XML like:
<root>just text</root>
Will now return:
"XML root element 'root' must be a map/object, got string"1 parent 52561d5 commit f34cdc3
2 files changed
+14
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
155 | | - | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
156 | 168 | | |
157 | 169 | | |
158 | 170 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| 102 | + | |
102 | 103 | | |
103 | 104 | | |
104 | 105 | | |
| |||
0 commit comments