فهرست منبع

catch TypeError

chenhaiyang 4 سال پیش
والد
کامیت
739f76ae48
1فایلهای تغییر یافته به همراه2 افزوده شده و 2 حذف شده
  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