Skip to content

catch group full exception and re-raise with more descriptive message #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 5, 2020

Conversation

FoamyGuy
Copy link
Contributor

Solves #11

This will show a more helpful message when user tries to set text to a string that is too long.

@FoamyGuy
Copy link
Contributor Author

This small snippet shows the new behavior:

import terminalio
from adafruit_display_text import label
label = label.Label(terminalio.FONT, text="123")
label.text = "1234"

Which is now:

Traceback (most recent call last):
  File "code.py", line 4, in <module>
  File "/lib/adafruit_display_text/label.py", line 246, in text
RuntimeError: Text length exceeds max_glyphs

@kmatch98
Copy link
Contributor

kmatch98 commented Jun 1, 2020

@FoamyGuy I looked over your code change and it looks like it will give a better notification when the max_glyphs is exceeded. Looks good to me.

@FoamyGuy FoamyGuy requested a review from a team June 5, 2020 01:48
@theacodes theacodes merged commit b536f4f into adafruit:master Jun 5, 2020
@FoamyGuy FoamyGuy deleted the better_group_full_error branch June 5, 2020 02:18
@evaherrada
Copy link
Collaborator

@FoamyGuy ooh, thanks so much for doing this. I can't tell you how annoyed I was getting when I was learning how to use this library and kept running into this issue and getting an error message that didn't really help at all.

adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Jun 9, 2020
Updating https://github.com/adafruit/Adafruit_CircuitPython_AHTx0 to 1.0.1 from 1.0.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_AHTx0#1 from kattni/example-i2c-update

Updating https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI to 3.4.1 from 3.4.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_ESP32SPI#99 from Flameeyes/master

Updating https://github.com/adafruit/Adafruit_CircuitPython_ILI9341 to 1.2.1 from 1.2.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_ILI9341#22 from makermelissa/master
  > Merge pull request adafruit/Adafruit_CircuitPython_ILI9341#21 from adafruit/setup-py-disabled
  > build.yml: add black formatting check

Updating https://github.com/adafruit/Adafruit_CircuitPython_LPS2X to 2.0.0 from 1.1.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_LPS2X#4 from adafruit/lps22
  > build.yml: add black formatting check

Updating https://github.com/adafruit/Adafruit_CircuitPython_Wiznet5k to 1.4.0 from 1.3.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_Wiznet5k#20 from xorbit/master
  > Merge pull request adafruit/Adafruit_CircuitPython_Wiznet5k#14 from adafruit/pylint-update

Updating https://github.com/adafruit/Adafruit_CircuitPython_AzureIoT to 2.2.1 from 2.2.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_AzureIoT#16 from jimbobbennett/master

Updating https://github.com/adafruit/Adafruit_CircuitPython_Display_Text to 2.7.0 from 2.6.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_Display_Text#49 from kmatch98/background
  > Merge pull request adafruit/Adafruit_CircuitPython_Display_Text#48 from FoamyGuy/better_group_full_error

Updating https://github.com/adafruit/Adafruit_CircuitPython_LED_Animation to 2.3.0 from 2.2.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_LED_Animation#39 from rhooper/bugfixes
  > Merge pull request adafruit/Adafruit_CircuitPython_LED_Animation#38 from rhooper/sequence-one-shot
  > Merge pull request adafruit/Adafruit_CircuitPython_LED_Animation#40 from rhooper/pixelgrid

Updating https://github.com/adafruit/Adafruit_CircuitPython_MiniMQTT to 3.1.0 from 3.0.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_MiniMQTT#38 from brentru/on-message-enhancements

Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA:
  > Added the following libraries: Adafruit_CircuitPython_ILI9341
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants