New submission from Irit Katriel <iritkatr...@gmail.com>:
The requirement comes from Hypothesis, see https://github.com/python/cpython/pull/28569#discussion_r730338369 It is necessary there to add a note to an exception describing which test case it comes from. The note should be printed by __str__ of this exception. class Explanation(Exception): __module__ = "builtins" def __str__(self) -> str: return f"\n{self.args[0]}" try: why = "Failed!" raise AssertionError(why) except Exception as e: msg = " You can reproduce this error by ...\n ..." raise Explanation(msg) from e # Ideally something more like: e.__note__ = msg raise ---------- components: Interpreter Core messages: 404999 nosy: iritkatriel priority: normal severity: normal status: open title: Make it possible to enrich an exception's error message type: enhancement _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue45607> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com