Explorar el Código

catch TypeError

chenhaiyang hace 4 años
padre
commit
739f76ae48
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      app/services/platform.py

+ 2 - 2
app/services/platform.py

@@ -64,7 +64,7 @@ class DataPlatformService(Service):
             if arrow.get(latest_time, TIME_FMT).shift(minutes=15) < arrow.get(self._now_time, TIME_FMT):
                 logger.info(f'delayed data - {object_id}: ({latest_time}, {latest_data})')
             value = round_half_up(latest_data, 2)
-        except KeyError and IndexError:
+        except KeyError and IndexError and TypeError:
             value = np.NAN
 
         return value
@@ -99,7 +99,7 @@ class DataPlatformService(Service):
             if arrow.get(latest_time, TIME_FMT).shift(minutes=15) < arrow.get(end_time, TIME_FMT):
                 logger.info(f'delayed data - {object_id}: ({latest_time}, {latest_data})')
             value = round_half_up(latest_data, 2)
-        except KeyError and IndexError:
+        except KeyError and IndexError and TypeError:
             value = np.NAN
 
         return value