pub fn truncate_error(error: &str, max_len: usize) -> String
Truncates an error string without splitting UTF-8 code points.