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 5
5
6
6
import { IStorageService , StorageScope } from 'vs/platform/storage/common/storage' ;
7
7
import { isEmptyObject } from 'vs/base/common/types' ;
8
+ import { onUnexpectedError } from 'vs/base/common/errors' ;
8
9
9
10
export type MementoObject = { [ key : string ] : any } ;
10
11
@@ -75,7 +76,15 @@ class ScopedMemento {
75
76
private load ( ) : MementoObject {
76
77
const memento = this . storageService . get ( this . id , this . scope ) ;
77
78
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
+ }
79
88
}
80
89
81
90
return { } ;
You can’t perform that action at this time.
0 commit comments