Mercurial > obsidian-remember-file-state
comparison src/main.ts @ 23:ba74a7d3709c
Add try/catch around restoring file state
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Fri, 18 Mar 2022 19:23:29 -0700 |
parents | f7e0926c2500 |
children | 3d0ac176118f |
comparison
equal
deleted
inserted
replaced
22:f7e0926c2500 | 23:ba74a7d3709c |
---|---|
205 // Don't restore the file state if: | 205 // Don't restore the file state if: |
206 // - We are suppressing it explicitly (such as if the file was | 206 // - We are suppressing it explicitly (such as if the file was |
207 // opened via clicking a hyperlink) | 207 // opened via clicking a hyperlink) |
208 // - The file is already currently open in another pane | 208 // - The file is already currently open in another pane |
209 if (!this._suppressNextFileOpen && !this.isFileMultiplyOpen(openedFile)) { | 209 if (!this._suppressNextFileOpen && !this.isFileMultiplyOpen(openedFile)) { |
210 this.restoreFileState(openedFile, activeView); | 210 try { |
211 this.restoreFileState(openedFile, activeView); | |
212 } catch (err) { | |
213 console.error("Couldn't restore file state: ", err); | |
214 } | |
211 } | 215 } |
212 } | 216 } |
213 // else: the file isn't handled by a markdown editor. | 217 // else: the file isn't handled by a markdown editor. |
214 | 218 |
215 this._suppressNextFileOpen = false; | 219 this._suppressNextFileOpen = false; |