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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Neradoc
Copy link

@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.

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.

2 participants