1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-24 13:52:55 +03:00

kitty: improve debug when image id is not found

Poking around at an issue, and thinking that some more context
might be nice.

Haven't managed to reproduce the issue so far though :-/

refs: https://github.com/wez/wezterm/issues/1156
This commit is contained in:
Wez Furlong 2021-12-23 15:04:19 -07:00
parent e3be779477
commit ac3cee3fc6

View File

@ -83,7 +83,12 @@ impl TerminalState {
&image_number
.ok_or_else(|| anyhow::anyhow!("no image_id or image_number specified!"))?,
)
.ok_or_else(|| anyhow::anyhow!("image_number has no matching image id"))?,
.ok_or_else(|| {
anyhow::anyhow!(
"image_number has no matching image id {:?} in number_to_id",
image_number
)
})?,
};
log::trace!(
@ -94,12 +99,13 @@ impl TerminalState {
verbosity
);
self.kitty_remove_placement(image_id, placement.placement_id);
let img = Arc::clone(
self.kitty_img
.id_to_data
.get(&image_id)
.ok_or_else(|| anyhow::anyhow!("no matching image id"))?,
);
let img = Arc::clone(self.kitty_img.id_to_data.get(&image_id).ok_or_else(|| {
anyhow::anyhow!(
"no matching image id {} in id_to_data for image_number {:?}",
image_id,
image_number
)
})?);
let (image_width, image_height) = match &*img.data() {
ImageDataType::EncodedFile(data) => {
@ -580,7 +586,11 @@ impl TerminalState {
image_number,
"ENOENT".to_string(),
);
anyhow::bail!("no matching image id")
anyhow::bail!(
"no matching image id {} in id_to_data for image_number {:?}",
image_id,
image_number
)
}
};