diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 5a9c975ad8319b43fcf0d861c9a38095c84acdab..0000000000000000000000000000000000000000 --- a/Dockerfile +++ /dev/null @@ -1,22 +0,0 @@ -FROM python:3.9 as build-stage - -RUN mkdir /home/doc - -WORKDIR /home - -RUN mkdir /home/src - -COPY ./requirements.txt . -COPY ./src /home/src - -RUN pip3 install -r requirements.txt - -WORKDIR /home/doc - -COPY ./doc . - -RUN make html - -FROM nginx - -COPY --from=build-stage /home/doc/build/html /usr/share/nginx/html diff --git a/README.md b/README.md index d1d45e44f1c1f77bdb47ea25a17dec8067b70d65..3549171b07e7f9cdd3064f4bdf7c47f671ff2e1c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # WZL-MQTT [](https://git-ce.rwth-aachen.de/wzl-mq-ms/forschung-lehre/digital-mars/mqtt/badges/master) -Current stable version: 2.5.0 +Current stable version: 2.5.1 ## Documentation @@ -84,6 +84,9 @@ Slightly more detailled examples can be found in the *sample* directory. If there are any questions contact [Matthias Bodenbenner](mailto:m.bodenbenner@wzl-mq.rwth-aachen.de). ## Changelog +2.5.1 + - increased verbosity in case of errors by including the full stack trace + 2.5.0 - changed signature of connect method - specifying the port is optional now, if not specified the port automatically is derived from the "websocket" and "ssl" flags diff --git a/default.conf b/default.conf deleted file mode 100644 index 294291e88769e674d902d683ddef85bff23e234a..0000000000000000000000000000000000000000 --- a/default.conf +++ /dev/null @@ -1,11 +0,0 @@ -server { - listen 80; - listen [::]:80; - server_name iot.wzl-mq.rwth-aachen.de; - - location /documentation/libs/mqtt { - alias /usr/share/nginx/html; - index index.html index.htm; - } - -} \ No newline at end of file diff --git a/doc/Dockerfile b/doc/Dockerfile deleted file mode 100644 index 2e7c7ed0ee57a3111fa0e41fe63ebe0bcae62587..0000000000000000000000000000000000000000 --- a/doc/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -FROM python:3.9 as build-stage - -RUN mkdir /home/doc - -COPY ../requirements.txt /home/doc - -WORKDIR /home/doc - -RUN pip install -r requirements.txt - -COPY . /home/doc - -RUN make html - -FROM nginx - -COPY --from=build-stage /home/app/doc/build/html /usr/share/nginx/html diff --git a/doc/default.conf b/doc/default.conf deleted file mode 100644 index 294291e88769e674d902d683ddef85bff23e234a..0000000000000000000000000000000000000000 --- a/doc/default.conf +++ /dev/null @@ -1,11 +0,0 @@ -server { - listen 80; - listen [::]:80; - server_name iot.wzl-mq.rwth-aachen.de; - - location /documentation/libs/mqtt { - alias /usr/share/nginx/html; - index index.html index.htm; - } - -} \ No newline at end of file diff --git a/doc/docker-compose.yml b/doc/docker-compose.yml deleted file mode 100644 index efe00733635a40b515600b4a29a03a618a5f29ec..0000000000000000000000000000000000000000 --- a/doc/docker-compose.yml +++ /dev/null @@ -1,17 +0,0 @@ -version: '3' -services: - - mqtt-documenation: - build: . - container_name: documentation-mqtt - networks: - - documentation-network - volumes: - - ./default.conf:/etc/nginx/conf.d/default.conf - ports: - - 9010:80 - restart: unless-stopped - -networks: - documentation-network: - external: true \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 88eeebd3cc51d9d4d3130fa12bccd5ccddcb6494..0000000000000000000000000000000000000000 --- a/docker-compose.yml +++ /dev/null @@ -1,17 +0,0 @@ -version: '3' -services: - - mqtt-documenation: - image: registry.git-ce.rwth-aachen.de/wzl-mq-ms/forschung-lehre/digital-mars/mqtt:latest - container_name: documentation-mqtt - networks: - - documentation-network - volumes: - - ./default.conf:/etc/nginx/conf.d/default.conf - ports: - - 9010:80 - restart: unless-stopped - -networks: - documentation-network: - external: true \ No newline at end of file diff --git a/setup.py b/setup.py index 6e5916f5f12138abc1be6de87fc1b3c2876de4c6..6a2113fd5da1d99745e1862df4de0a8bf8d80303 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup, find_packages setup(name='wzl-mqtt', - version='2.5.0', + version='2.5.1', url='', author='Matthias Bodenbenner, Benjamin Montavon', author_email='m.bodenbenner@wzl-mq.rwth-aachen.de', diff --git a/src/mqtt/client.py b/src/mqtt/client.py index 4dc84f8880dee604f15d2582c893c9ab9651a376..2df94628aa8b1902f8a3f103334b2f149536f524 100644 --- a/src/mqtt/client.py +++ b/src/mqtt/client.py @@ -1,14 +1,16 @@ import inspect +import sys +import traceback import uuid import warnings from typing import Callable, Union import paho.mqtt.client as mqtt -from .logger import Logger from .exceptions import ConnectionError from .exceptions import PublishError from .exceptions import SubscriptionError +from .logger import Logger class MQTTClient: @@ -126,7 +128,8 @@ class MQTTClient: self._logger.error( "MQTT Client {} could not connect to {}:{} : {}".format( self.name, broker, port, str(exception))) - raise ConnectionError(str(exception)) + tb = sys.exc_info()[2] + raise ConnectionError(str(exception)).with_traceback(tb) def disconnect(self): """Disconnects the client and closes the connection to the broker. @@ -138,7 +141,8 @@ class MQTTClient: self._logger.error( "MQTT Client {} could not disconnect: {}".format(self.name, str(exception))) - raise ConnectionError(str(exception)) + tb = sys.exc_info()[2] + raise ConnectionError(str(exception)).with_traceback(tb) def _on_connect(self, client, userdata, flags, rc): if rc == 0: @@ -218,7 +222,8 @@ class MQTTPublisher(MQTTClient): "MQTT Client {} could not publish to {}: {}".format(self.name, topic, str(exception))) - raise PublishError(str(exception)) + tb = sys.exc_info()[2] + raise PublishError(str(exception)).with_traceback(tb) def _on_publish(self, client, userdata, mid): self._logger.debug( @@ -280,7 +285,8 @@ class MQTTSubscriber(MQTTClient): "MQTT Client {} could not subscribe to {}: {}".format(self.name, topic, str(exception))) - raise SubscriptionError(str(exception)) + tb = sys.exc_info()[2] + raise SubscriptionError(str(exception)).with_traceback(tb) def unsubscribe(self, topic: str): """Unsubscribes to updates of the given topic. @@ -306,7 +312,8 @@ class MQTTSubscriber(MQTTClient): self._logger.error( "MQTT Client {} could not unsubscribe from {}: {}".format( self.name, topic, str(exception))) - raise SubscriptionError(str(exception)) + tb = sys.exc_info()[2] + raise SubscriptionError(str(exception)).with_traceback(tb) def set_callback(self, key: str, function: Callable): """Add a callback called at each received message. @@ -370,6 +377,7 @@ class MQTTSubscriber(MQTTClient): try: self._on_message_callbacks[key](message.topic, message.payload) except Exception as exception: + self._logger.error(traceback.format_exc()) self._logger.error( "Exception while processing callback for topic {}: {}".format( message.topic, str(exception)))