Skip to content

Commit d735393

Browse files
authored
1 parent ed15973 commit d735393

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/vs/workbench/common/memento.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
77
import { isEmptyObject } from 'vs/base/common/types';
8+
import { onUnexpectedError } from 'vs/base/common/errors';
89

910
export 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 {};

0 commit comments

Comments
 (0)