import MySQLdb


class DataService:
    def __init__(self, mysql_config):
        self.config = mysql_config
        self.db = MySQLdb.connect(host=mysql_config['host'],
                                  db=mysql_config['database'],
                                  user=mysql_config['user'],
                                  passwd=mysql_config['password'])

    def save_temperature(self, value):
        pass

@@ -8,16 +8,41 @@
 MySQLdb%0A
+import _mysql_exceptions%0A
 %0A%0Aclass 
@@ -127,16 +127,33 @@
 _config%0A
+        try:%0A    
         
@@ -239,16 +239,20 @@
         
+ 
+   
 db=mysql
@@ -268,24 +268,28 @@
 database'%5D,%0A
+    
             
@@ -367,24 +367,28 @@
             
+    
 passwd=mysql
@@ -407,16 +407,124 @@
 sword'%5D)
+%0A        except _mysql_exceptions.OperationalError:%0A            print('couldn%5C't connect to MySQL database')
 %0A%0A    de

add exception handling for MySQL connection error