-
Notifications
You must be signed in to change notification settings - Fork 71
Open
Labels
Description
This was originally reported in #425.
#[test]
fn notify_field_error() {
let server_config = r#"
addr: irc.libera.chat
join: []
extra1: a
extra2: b
notify: [mentions]
"#;
match serde_yaml::from_str::<Server>(server_config) {
Ok(ok) => {
dbg!(ok);
panic!("Config parsing should've been failed");
}
Err(err) => {
dbg!(err);
}
}
}(add this to crates/libtiny_tui/src/config.rs)
Here the problem is notify field is a sequence, but it should be a string.
The error currently looks like this: (tiny efa1d22, uses serde 1.0.193 and serde_yaml 0.8.26)
[crates/libtiny_tui/src/config.rs:538] err = Message(
"invalid type: sequence, expected string or map",
Some(
Pos {
marker: Marker {
index: 5,
line: 2,
col: 4,
},
path: ".",
},
),
)
Here the line number is incorrect, it should've been 5 (or 4 if it's 0 based).
This is a serde_yaml bug, first reported in 2019: dtolnay/serde-yaml#128.
To work around the bug, we could manually "flatten" the TabConfig type in server, channel, and default configs, keep this bug open, and revert the change if the bug in serde_yaml is fixed one day.