Return an ExceptionInfo matching the current traceback. .. warning:: Experimental API :param exprinfo: A text string helping to determine if we should strip ``AssertionError`` from the output. Defaults to the exception message/``__st
(cls, exprinfo: str | None = None)
| 567 | |
| 568 | @classmethod |
| 569 | def from_current(cls, exprinfo: str | None = None) -> ExceptionInfo[BaseException]: |
| 570 | class="st">"""Return an ExceptionInfo matching the current traceback. |
| 571 | |
| 572 | .. warning:: |
| 573 | |
| 574 | Experimental API |
| 575 | |
| 576 | :param exprinfo: |
| 577 | A text string helping to determine if we should strip |
| 578 | ``AssertionError`` from the output. Defaults to the exception |
| 579 | message/``__str__()``. |
| 580 | class="st">""" |
| 581 | tup = sys.exc_info() |
| 582 | assert tup[0] is not None, class="st">"no current exception" |
| 583 | assert tup[1] is not None, class="st">"no current exception" |
| 584 | assert tup[2] is not None, class="st">"no current exception" |
| 585 | exc_info = (tup[0], tup[1], tup[2]) |
| 586 | return ExceptionInfo.from_exc_info(exc_info, exprinfo) |
| 587 | |
| 588 | @classmethod |
| 589 | def for_later(cls) -> ExceptionInfo[E]: |