Browse Source

catch TypeError

chenhaiyang 4 years ago
parent
commit
739f76ae48
1 changed files with 2 additions and 2 deletions
  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