Skip to content

Commit 704666e

Browse files
committed
Only print a traceback if there is one to print
1 parent d6c6cf3 commit 704666e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cmd2/cmd2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ def perror(self, err: Union[str, Exception], traceback_war: bool = True, err_col
587587
:param err_color: (optional) color escape to output error with
588588
:param war_color: (optional) color escape to output warning with
589589
"""
590-
if self.debug:
590+
if self.debug and sys.exc_info() != (None, None, None):
591591
import traceback
592592
traceback.print_exc()
593593

0 commit comments

Comments
 (0)