瀏覽代碼

add warning

Falko Schindler 1 年之前
父節點
當前提交
3618ca5552
共有 1 個文件被更改,包括 2 次插入0 次删除
  1. 2 0
      nicegui/storage.py

+ 2 - 0
nicegui/storage.py

@@ -13,6 +13,7 @@ from starlette.requests import Request
 from starlette.responses import Response
 
 from . import background_tasks, context, core, json, observables
+from .logging import log
 
 request_contextvar: contextvars.ContextVar[Optional[Request]] = contextvars.ContextVar('request_var', default=None)
 
@@ -46,6 +47,7 @@ class PersistentDict(observables.ObservableDict):
         try:
             data = json.loads(filepath.read_text()) if filepath.exists() else {}
         except Exception:
+            log.warning(f'Could not load storage file {filepath}')
             data = {}
         super().__init__(data, on_change=self.backup)