From 3a54fb1f532e2bc923ae9051e84076ef54189924 Mon Sep 17 00:00:00 2001
From: Matthias Bodenbenner <m.bodenbenner@wzl.rwth-aachen.de>
Date: Thu, 21 Oct 2021 10:59:09 +0200
Subject: [PATCH] made error message more precise

---
 .gitignore         |  2 ++
 README.md          |  3 +++
 setup.py           |  2 +-
 src/mqtt/client.py | 10 ++++++----
 4 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/.gitignore b/.gitignore
index d02036f..fac4925 100644
--- a/.gitignore
+++ b/.gitignore
@@ -114,3 +114,5 @@ venv.bak/
 .vscode/settings.json
 
 logs/
+
+private_testing/
diff --git a/README.md b/README.md
index 8748f45..f972812 100644
--- a/README.md
+++ b/README.md
@@ -79,6 +79,9 @@ To obtain credentials for MQTT-Broker of WZL-MQ-MS contact [Mark Sanders](mailto
 For more detailed explanation and full API documentation, view [https://iot.wzl-mq.rwth-aachen.de/documentation/libs/mqtt/](https://iot.wzl-mq.rwth-aachen.de/documentation/libs/mqtt/)
 
 ## Changelog
+2.4.1
+- made the error message of code 1 more precise
+
 2.4.0
 - added vhost parameter to connect function of client
 - changed default logging behaviour
diff --git a/setup.py b/setup.py
index 7ce55fa..cc01c2f 100644
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,7 @@
 from setuptools import setup, find_packages
 
 setup(name='wzl-mqtt',
-      version='2.4.0',
+      version='2.4.1',
       url='',
       author='Benjamin Montavon, Matthias Bodenbenner',
       author_email='m.bodenbenner@wzl.rwth-aachen.de',
diff --git a/src/mqtt/client.py b/src/mqtt/client.py
index a17815c..ba065ca 100644
--- a/src/mqtt/client.py
+++ b/src/mqtt/client.py
@@ -144,10 +144,12 @@ class MQTTClient:
     def _on_disconnect(self, client, userdata, rc):
         if rc == 1:
             self._logger.error(
-                "MQTT Client {} disconnected with code {} ({}). \n \t There are two possible reasons: \n"
-                "\t\t 1. You may tried to use Publisher-Credentials for receiving messages or vise versa.\n"
-                "\t\t 2. You tried to publish to or subscribe a topic which you are not allowed to do. \n"
-                "Please contact Mark Sanders or Matthias Bodenbenner, to check if your login credentials are correct!".format(
+                "MQTT Client {} disconnected with code {} ({}). \n \t There are various possible reasons for that: \n"
+                "\t\t 1. You used port 8883 but did not set the 'ssl' flag (or used port 1883 and set the 'ssl' flag).\n"
+                "\t\t 2. You may tried to use Publisher-Credentials for receiving messages or vise versa.\n"
+                "\t\t 3. You tried to publish to or subscribe a topic which you are not allowed to do. \n"
+                "\t\t 4. Something else, which has not been experienced by the developers of this library. Sorry!\n"
+                "If you don't find a solution, please contact Mark Sanders or Matthias Bodenbenner to check if your login credentials are correct!".format(
                     self.name, rc, mqtt.error_string(rc)))
         else:
             self._logger.info(
-- 
GitLab