From 73ad8ef1f7801f1a5c5ee9b184163f3776e2253c Mon Sep 17 00:00:00 2001 From: jack1142 <6032823+jack1142@users.noreply.github.com> Date: Sat, 10 Apr 2021 14:23:10 +0200 Subject: [PATCH] Stop showing colon after exception type when there is no message --- rich/traceback.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rich/traceback.py b/rich/traceback.py index c3f5c0eb..23c6b24a 100644 --- a/rich/traceback.py +++ b/rich/traceback.py @@ -444,11 +444,13 @@ class Traceback: (f"{stack.exc_type}: ", "traceback.exc_type"), highlighter(stack.syntax_error.msg), ) - else: + elif stack.exc_value: yield Text.assemble( (f"{stack.exc_type}: ", "traceback.exc_type"), highlighter(stack.exc_value), ) + else: + yield Text.assemble((f"{stack.exc_type}", "traceback.exc_type")) if not last: if stack.is_cause: