[issue18163] Add a 'key' attribute to KeyError
Orian Zinger added the comment: Hi all, As a Python developer, I encountered lots of blurry exception messages in the product logs such as: Failed to do something. Exception: 'some key' I believe printing the key name without explaining the exception itself is bad (explicit is better than implicit). Thus, after forking the repository, I added a short explanation about the Exception. Now, it looks like: >>> try: ... {}['some key'] ... except Exception as e: ... print(e) ... Missing key: some key I'm a newbie in a contribution to CPython, so please let me know if the idea behind my commit is good. If not, please explain how can I improve my commit so it'll be pulled later to the main branch. https://github.com/zingero/cpython/commit/8c9e5d9e16296cee1f3ec05638dd6989dae8b811 Regards, Orian. -- components: +Library (Lib) -Interpreter Core nosy: +zingero ___ Python tracker <https://bugs.python.org/issue18163> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18163] Add a 'key' attribute to KeyError
Change by Orian Zinger : -- components: -Library (Lib) ___ Python tracker <https://bugs.python.org/issue18163> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue42177] Improving KeyError exception
New submission from Orian Zinger : Hi all, As a Python developer, I encountered lots of blurry exception messages in the product logs such as: Failed to do something. Exception: 'some key' I believe printing the key name without explaining the exception itself is bad (explicit is better than implicit). Thus, after forking the repository, I added a short explanation about the Exception. Now, it looks like: >>> try: ... {}['some key'] ... except Exception as e: ... print(e) ... Missing key: some key I'm a newbie in a contribution to CPython, so please let me know if the idea behind my commit is good. If not, please explain how can I improve my commit so it'll be pulled later to the main branch. https://github.com/zingero/cpython/commit/8c9e5d9e16296cee1f3ec05638dd6989dae8b811 Regards, Orian. -- messages: 379801 nosy: zingero priority: normal severity: normal status: open title: Improving KeyError exception type: enhancement ___ Python tracker <https://bugs.python.org/issue42177> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com