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: Optional[str] = None
)
| 494 | |
| 495 | @classmethod |
| 496 | def from_current( |
| 497 | cls, exprinfo: Optional[str] = None |
| 498 | ) -> "ExceptionInfo[BaseException]": |
| 499 | """Return an ExceptionInfo matching the current traceback. |
| 500 | |
| 501 | .. warning:: |
| 502 | |
| 503 | Experimental API |
| 504 | |
| 505 | :param exprinfo: |
| 506 | A text string helping to determine if we should strip |
| 507 | ``AssertionError`` from the output. Defaults to the exception |
| 508 | message/``__str__()``. |
| 509 | """ |
| 510 | tup = sys.exc_info() |
| 511 | assert tup[0] is not None, "no current exception" |
| 512 | assert tup[1] is not None, "no current exception" |
| 513 | assert tup[2] is not None, "no current exception" |
| 514 | exc_info = (tup[0], tup[1], tup[2]) |
| 515 | return ExceptionInfo.from_exc_info(exc_info, exprinfo) |
| 516 | |
| 517 | @classmethod |
| 518 | def for_later(cls) -> "ExceptionInfo[E]": |