@cryptotaxi247 / netdata-1 / commits / ba417a23c

better error messages

paulfantom committed Jul 2, 2016 at 23:01 UTC ba417a23c8d95a8312369305b2d9f272923fbc80
1 file changed +2 -5
python.d/mysql.chart.py
+2 -5
@@ -2,12 +2,9 @@
2 # Description: MySQL netdata python.d plugin
3 # Author: Pawel Krupa (paulfantom)
4
5 -import os
5 from base import SimpleService
6 import msg
7
9 -NAME = os.path.basename(__file__).replace(".chart.py", "")
10 -
8 # import 3rd party library to handle MySQL communication
9 try:
10 import MySQLdb
@@ -355,7 +352,7 @@ class Service(SimpleService):
352 port=self.configuration['port'],
353 connect_timeout=self.update_every)
354 except Exception as e:
358 - self.error(NAME + " has problem connecting to server:", e)
355 + self.error("problem connecting to server:", e)
356 raise RuntimeError
357
358 def _format_data(self):
@@ -373,7 +370,7 @@ class Service(SimpleService):
370 cursor.execute(QUERY)
371 raw_data = cursor.fetchall()
372 except Exception as e:
376 - self.error(NAME + ": cannot execute query.", e)
373 + self.error("cannot execute query.", e)
374 self.connection.close()
375 self.connection = None
376 return None