Method
exception_args_as_string
(&self, varargs: PyTupleRef, str_single: bool)
Source from the content-addressed store, hash-verified
| 299 | } |
| 300 | |
| 301 | fn exception_args_as_string(&self, varargs: PyTupleRef, str_single: bool) -> Vec<PyStrRef> { |
| 302 | let vm = self; |
| 303 | match varargs.len() { |
| 304 | 0 => vec![], |
| 305 | 1 => { |
| 306 | let args0_repr = if str_single { |
| 307 | varargs[0] |
| 308 | .str(vm) |
| 309 | .unwrap_or_else(|_| PyStr::from("<element str() failed>").into_ref(&vm.ctx)) |
| 310 | } else { |
| 311 | varargs[0].repr(vm).unwrap_or_else(|_| { |
| 312 | PyStr::from("<element repr() failed>").into_ref(&vm.ctx) |
| 313 | }) |
| 314 | }; |
| 315 | vec![args0_repr] |
| 316 | } |
| 317 | _ => varargs |
| 318 | .iter() |
| 319 | .map(|vararg| { |
| 320 | vararg.repr(vm).unwrap_or_else(|_| { |
| 321 | PyStr::from("<element repr() failed>").into_ref(&vm.ctx) |
| 322 | }) |
| 323 | }) |
| 324 | .collect(), |
| 325 | } |
| 326 | } |
| 327 | |
| 328 | pub fn split_exception( |
| 329 | &self, |
Tested by
no test coverage detected