浏览代码

Улучшение обработки ошибок

Book Pauk 3 年之前
父节点
当前提交
bcf3c2dab0
共有 1 个文件被更改,包括 10 次插入1 次删除
  1. 10 1
      client/components/Reader/Reader.vue

+ 10 - 1
client/components/Reader/Reader.vue

@@ -585,10 +585,19 @@ class Reader {
             //сохранение в serverStorage
             if (value) {
                 await utils.sleep(500);
+                
+                let timer = setTimeout(() => {
+                    if (!this.offlineModeActive)
+                        this.$root.notify.error('Таймаут соединения');
+                }, 10000);
+
                 try {
                     await this.$refs.serverStorage.saveRecent(value);
                 } catch (e) {
-                    this.$root.notify.error(e.message);
+                    if (!this.offlineModeActive)
+                        this.$root.notify.error(e.message);
+                } finally {
+                    clearTimeout(timer);
                 }
             }
         }