Skip to content

Commit

Permalink
truncate TextOverLength message
Browse files Browse the repository at this point in the history
  • Loading branch information
MeetWq committed Sep 25, 2024
1 parent 585f668 commit e1e6090
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion meme_generator/exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ class TextOverLength(MemeGeneratorException):

def __init__(self, text: str):
self.text = text
message = f"文本“{self.text}”过长"
repr = text if len(text) <= 10 else (text[:10] + "...")
message = f"文本“{repr}”过长"
super().__init__(message)


Expand Down

0 comments on commit e1e6090

Please sign in to comment.