This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author YoSTEALTH
Recipients YoSTEALTH
Date 2019-12-15.08:50:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1576399847.23.0.606573681326.issue39053@roundup.psfhosted.org>
In-reply-to
Content
class Some_Class:

    def error(self):
        if not getattr(self, 'boo', None):
            raise Exception(f'`class {self.__class__.__name__}:` raised some error!')


something = Some_Class()
something.error()


# This is how Error looks
# -----------------------
Traceback (most recent call last):
  File "/test.py", line 9, in <module>
    something.error()
  File "/test.py", line 5, in error
    raise Exception(f'`class {self.__class__.__name__}:` raised some error!')
Exception: `class Some_Class:` raised some error!


# This is how Error should look
# -----------------------------
Traceback (most recent call last):
  File "/test.py", line 9, in <module>
    something.error()
  File "/test.py", line 5, in error
    raise Exception(...)
Exception: `class Some_Class:` raised some error!


When a developer manually raises an error they want the user/developer debugging the error to see the final, nicely formatted error message itself "Exception: `class Some_Class:` raised some error!" not the ugly formating of the error message itself "raise Exception(f'`class {self.__class__.__name__}:` raised some error!')" which can also lead to confusion, thus it should be hidden as "raise Exception(...)"

It could also be said that "raise Exception(...)" shouldn't even be shown but what raises this error condition "if not getattr(self, 'boo', None):" but this seems more work so i am keeping it simple by saying lets just hide the ugly formatting part.
History
Date User Action Args
2019-12-15 08:50:47YoSTEALTHsetrecipients: + YoSTEALTH
2019-12-15 08:50:47YoSTEALTHsetmessageid: <1576399847.23.0.606573681326.issue39053@roundup.psfhosted.org>
2019-12-15 08:50:47YoSTEALTHlinkissue39053 messages
2019-12-15 08:50:46YoSTEALTHcreate