File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 55
66import { IStorageService , StorageScope } from 'vs/platform/storage/common/storage' ;
77import { isEmptyObject } from 'vs/base/common/types' ;
8+ import { onUnexpectedError } from 'vs/base/common/errors' ;
89
910export type MementoObject = { [ key : string ] : any } ;
1011
@@ -75,7 +76,15 @@ class ScopedMemento {
7576 private load ( ) : MementoObject {
7677 const memento = this . storageService . get ( this . id , this . scope ) ;
7778 if ( memento ) {
78- return JSON . parse ( memento ) ;
79+ try {
80+ return JSON . parse ( memento ) ;
81+ } catch ( error ) {
82+ // Seeing reports from users unable to open editors
83+ // from memento parsing exceptions. Log the contents
84+ // to diagnose further
85+ // https://github.com/microsoft/vscode/issues/102251
86+ onUnexpectedError ( `[memento]: failed to parse contents: ${ error } (id: ${ this . id } , scope: ${ this . scope } , contents: ${ memento } )` ) ;
87+ }
7988 }
8089
8190 return { } ;
You can’t perform that action at this time.
0 commit comments