Skip to content

Commit b536f4f

Browse files
authored
Merge pull request #48 from FoamyGuy/better_group_full_error
catch group full exception and re-raise with more descriptive message
2 parents 463fc68 + a392523 commit b536f4f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

adafruit_display_text/label.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,12 @@ def text(self):
238238

239239
@text.setter
240240
def text(self, new_text):
241-
current_anchored_position = self.anchored_position
242-
self._update_text(str(new_text))
243-
self.anchored_position = current_anchored_position
241+
try:
242+
current_anchored_position = self.anchored_position
243+
self._update_text(str(new_text))
244+
self.anchored_position = current_anchored_position
245+
except RuntimeError:
246+
raise RuntimeError("Text length exceeds max_glyphs")
244247

245248
@property
246249
def font(self):

0 commit comments

Comments
 (0)