提交 7fc80e5f 编写于 作者: J Joao Moreno

catch bad obsolete file format

fixes #9935
上级 943835bf
......@@ -255,7 +255,7 @@ export class ExtensionManagementService implements IExtensionManagementService {
let result: T = null;
return pfs.readFile(this.obsoletePath, 'utf8')
.then(null, err => err.code === 'ENOENT' ? TPromise.as('{}') : TPromise.wrapError(err))
.then<{ [id: string]: boolean }>(raw => JSON.parse(raw))
.then<{ [id: string]: boolean }>(raw => { try { return JSON.parse(raw); } catch (e) { return {}; }})
.then(obsolete => { result = fn(obsolete); return obsolete; })
.then(obsolete => {
if (Object.keys(obsolete).length === 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册