Add debug info to invalid offset error

This commit is contained in:
Lukas Wirth 2024-06-05 10:20:05 +02:00
parent 29e5cdfb05
commit 5a7f2dd4b0

View File

@ -37,8 +37,9 @@ pub(crate) fn offset(
.ok_or_else(|| format_err!("Invalid wide col offset"))?
}
};
let text_size =
line_index.index.offset(line_col).ok_or_else(|| format_err!("Invalid offset"))?;
let text_size = line_index.index.offset(line_col).ok_or_else(|| {
format_err!("Invalid offset {line_col:?} (line index length: {:?})", line_index.index.len())
})?;
Ok(text_size)
}