-
Notifications
You must be signed in to change notification settings - Fork 783
Exceptions notes (PEP 678 since Python 3.11) are not properly formatted #980
Copy link
Copy link
Closed
Labels
enhancementImprovement to an already existing featureImprovement to an already existing feature
Description
The following code:
import sys
from loguru import logger
@logger.catch
def main():
try:
raise ValueError("Error")
except Exception as e:
e.add_note("Note 1")
e.add_note("Note 2")
raise
logger.remove()
logger.add(sys.stderr, diagnose=True, backtrace=False, colorize=True)
main()Causes the ValueError to be formatted as follows:
Traceback (most recent call last):
File "/home/delgan/test.py", line 18, in <module>
main()
└ <function main at 0x7f77a3142020>
File "/home/delgan/test.py", line 8, in main
raise ValueError("Error")
ValueError: Error
Note 1
Note 2Expected output is more like this:
Traceback (most recent call last):
File "/home/delgan/test.py", line 18, in <module>
main()
└ <function main at 0x7f77a3142020>
File "/home/delgan/test.py", line 8, in main
raise ValueError("Error")
ValueError: Error
Note 1
Note 2Also the ansi colors are wrong, as currently "Note 2" is highlighted instead of "ValueError: Error".
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementImprovement to an already existing featureImprovement to an already existing feature