Skip to content

Fix missing parameter in MMQTTException #249

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
Apr 24, 2025

Conversation

Neradoc
Copy link
Contributor

@Neradoc Neradoc commented Apr 13, 2025

This fixes raising a MMQTTException with no argument, raising a TypeError, when it requires an error argument, as reported in #248

Traceback (most recent call last):
  File "adafruit_minimqtt/adafruit_minimqtt.py", line 1036, in _wait_for_msg
  File "adafruit_minimqtt/adafruit_minimqtt.py", line 1124, in _sock_exact_recv
  File "adafruit_esp32spi/adafruit_esp32spi_socketpool.py", line 171, in recv_into
  File "adafruit_esp32spi/adafruit_esp32spi_socketpool.py", line 198, in _available
  File "adafruit_esp32spi/adafruit_esp32spi.py", line 892, in socket_available
  File "adafruit_esp32spi/adafruit_esp32spi.py", line 431, in _send_command_get_response
  File "adafruit_esp32spi/adafruit_esp32spi.py", line 398, in _wait_response_cmd
  File "adafruit_esp32spi/adafruit_esp32spi.py", line 377, in _wait_spi_char
TimeoutError: Timed out waiting for SPI char

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "code.py", line 247, in <module>
  File "adafruit_minimqtt/adafruit_minimqtt.py", line 1011, in loop
  File "adafruit_minimqtt/adafruit_minimqtt.py", line 1041, in _wait_for_msg
TypeError: function takes 3 positional arguments but 2 were given

Code done running.

Notes that: raise MMQTTException is equivalent to raise MMQTTException()

It should now be (didn't test)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "code.py", line 247, in <module>
  File "adafruit_minimqtt/adafruit_minimqtt.py", line 1011, in loop
  File "adafruit_minimqtt/adafruit_minimqtt.py", line 1041, in _wait_for_msg
MMQTTException: Unexpected error while waiting for messages

Code done running.

@dglaude
Copy link

dglaude commented Apr 13, 2025

I confirm that this kind of change fixed the problem for me.

I used this for a few hours and the problem did not reoccur (or I was able to catch the exception and retry):

raise MMQTTException("Please insert meaningfull message here.") from error

I don't know what should be the right string, but @Neradoc version is certainly better than mine.

Copy link
Contributor

@FoamyGuy FoamyGuy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, looks good to me.

@FoamyGuy FoamyGuy merged commit 6f01392 into adafruit:main Apr 24, 2025
1 check passed
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Apr 25, 2025
Updating https://github.com/adafruit/Adafruit_CircuitPython_LED_Animation to 2.12.0 from 2.11.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_LED_Animation#125 from jposada202020/PacMan_animation
  > Merge pull request adafruit/Adafruit_CircuitPython_LED_Animation#124 from jposada202020/blink-with-user-color-selected-background

Updating https://github.com/adafruit/Adafruit_CircuitPython_MatrixPortal to 3.2.5 from 3.2.3:
  > Merge pull request adafruit/Adafruit_CircuitPython_MatrixPortal#100 from Neradoc/fix-feather-pins
  > Merge pull request adafruit/Adafruit_CircuitPython_MatrixPortal#99 from Neradoc/fix-matrix-docs

Updating https://github.com/adafruit/Adafruit_CircuitPython_MiniMQTT to 8.0.1 from 8.0.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_MiniMQTT#249 from Neradoc/fix-missing-exception-argument

Updating https://github.com/adafruit/Adafruit_CircuitPython_Pathlib to 1.0.1 from 1.0.0:
  > use characters we can show with terminalio in example readme code
  > use characters we can show with terminalio in example

Updating https://github.com/adafruit/Adafruit_CircuitPython_ProgressBar to 2.3.17 from 2.3.16:
  > Merge pull request adafruit/Adafruit_CircuitPython_ProgressBar#41 from dglaude/patch-1

Updating https://github.com/adafruit/Adafruit_CircuitPython_USB_Host_Descriptors to 0.3.0 from 0.2.3:
  > Merge pull request adafruit/Adafruit_CircuitPython_USB_Host_Descriptors#7 from FoamyGuy/find_boot_keyboard

Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA:
  > Added the following libraries: Adafruit_CircuitPython_Pathlib
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.

3 participants