Print exception occurrence location from traceback element
(
output: &mut W,
tb_entry: &Py<PyTraceback>,
)
| 394 | |
| 395 | /// Print exception occurrence location from traceback element |
| 396 | fn write_traceback_entry<W: Write>( |
| 397 | output: &mut W, |
| 398 | tb_entry: &Py<PyTraceback>, |
| 399 | ) -> Result<(), W::Error> { |
| 400 | let filename = tb_entry.frame.code.source_path().as_str(); |
| 401 | writeln!( |
| 402 | output, |
| 403 | r##" File "{}", line {}, in {}"##, |
| 404 | filename.trim_start_matches(r"\\?\"), |
| 405 | tb_entry.lineno, |
| 406 | tb_entry.frame.code.obj_name |
| 407 | )?; |
| 408 | print_source_line(output, filename, tb_entry.lineno.get())?; |
| 409 | |
| 410 | Ok(()) |
| 411 | } |
| 412 | |
| 413 | #[derive(Clone)] |
| 414 | pub enum ExceptionCtor { |
no test coverage detected