eclipse-theia/theia

[preferences][enhancement] Provide a better error message when the user/workspace file is not a valid JSON

Open

#7,138 opened on Feb 12, 2020

View on GitHub
 (3 comments) (0 reactions) (0 assignees)TypeScript (2,478 forks)batch import
enhancementhelp wantedpreferences

Repository metrics

Stars
 (18,676 stars)
PR merge metrics
 (Avg merge 15d 4h) (75 merged PRs in 30d)

Description

Description

Reproduction Steps

  • Manually edit one of the settings.json file. Make it an invalid JSON.
  • Restart the frontend app.

User error: Screen Shot 2020-02-12 at 10 06 27

The user might not know what the user_storage:settings.json means.

Error in the browser console:

root ERROR Failed to update the value of workbench.iconTheme. Error: Can not add index to parent of type property
log @ logger-protocol.ts:112
(anonymous) @ logger-frontend-module.ts:41
(anonymous) @ logger.ts:312
(anonymous) @ logger.ts:304
Promise.then (async)
../node_modules/@theia/core/lib/common/logger.js.Logger.log @ logger.ts:299
log @ logger.ts:45
(anonymous) @ abstract-resource-preference-provider.ts:116
step @ abstract-resource-preference-provider.ts:15
(anonymous) @ abstract-resource-preference-provider.ts:15
fulfilled @ abstract-resource-preference-provider.ts:15
Promise.then (async)
step @ abstract-resource-preference-provider.ts:15
fulfilled @ abstract-resource-preference-provider.ts:15
Promise.then (async)
step @ abstract-resource-preference-provider.ts:15
(anonymous) @ abstract-resource-preference-provider.ts:15
push.../node_modules/@theia/preferences/lib/browser/abstract-resource-preference-provider.js.__awaiter @ abstract-resource-preference-provider.ts:15
push.../node_modules/@theia/preferences/lib/browser/abstract-resource-preference-provider.js.AbstractResourcePreferenceProvider.setPreference @ abstract-resource-preference-provider.ts:89
(anonymous) @ preference-service.ts:260
step @ preference-service.ts:15
(anonymous) @ preference-service.ts:15
(anonymous) @ preference-service.ts:15
../node_modules/@theia/core/lib/browser/preferences/preference-service.js.__awaiter @ preference-service.ts:15
../node_modules/@theia/core/lib/browser/preferences/preference-service.js.PreferenceServiceImpl.set @ preference-service.ts:251
../node_modules/@theia/core/lib/browser/common-frontend-contribution.js.CommonFrontendContribution.updateThemePreference @ common-frontend-contribution.ts:315
(anonymous) @ common-frontend-contribution.ts:297
(anonymous) @ event.ts:117
../node_modules/@theia/core/lib/common/event.js.CallbackList.invoke @ event.ts:125
../node_modules/@theia/core/lib/common/event.js.Emitter.fire @ event.ts:217
set @ icon-theme-service.ts:172
../node_modules/@theia/core/lib/browser/icon-theme-contribution.js.DefaultFileIconThemeContribution.registerIconThemes @ icon-theme-contribution.ts:56
(anonymous) @ icon-theme-contribution.ts:40
step @ icon-theme-contribution.ts:15
(anonymous) @ icon-theme-contribution.ts:15
(anonymous) @ icon-theme-contribution.ts:15
../node_modules/@theia/core/lib/browser/icon-theme-contribution.js.__awaiter @ icon-theme-contribution.ts:15
../node_modules/@theia/core/lib/browser/icon-theme-contribution.js.IconThemeApplicationContribution.onStart @ icon-theme-contribution.ts:38
(anonymous) @ frontend-application.ts:335
(anonymous) @ frontend-application.ts:365
step @ frontend-application.ts:15
(anonymous) @ frontend-application.ts:15
(anonymous) @ frontend-application.ts:15
../node_modules/@theia/core/lib/browser/frontend-application.js.__awaiter @ frontend-application.ts:15
../node_modules/@theia/core/lib/browser/frontend-application.js.FrontendApplication.measure @ frontend-application.ts:361
(anonymous) @ frontend-application.ts:334
step @ frontend-application.ts:15
(anonymous) @ frontend-application.ts:15
step @ frontend-application.ts:15
(anonymous) @ frontend-application.ts:15
fulfilled @ frontend-application.ts:15
Promise.then (async)
step @ frontend-application.ts:15
(anonymous) @ frontend-application.ts:15
../node_modules/@theia/core/lib/browser/frontend-application.js.__awaiter @ frontend-application.ts:15
../node_modules/@theia/core/lib/browser/frontend-application.js.FrontendApplication.startContributions @ frontend-application.ts:302
(anonymous) @ frontend-application.ts:123
step @ frontend-application.ts:15
(anonymous) @ frontend-application.ts:15
(anonymous) @ frontend-application.ts:15
../node_modules/@theia/core/lib/browser/frontend-application.js.__awaiter @ frontend-application.ts:15
../node_modules/@theia/core/lib/browser/frontend-application.js.FrontendApplication.start @ frontend-application.ts:122
start @ index.js:38
Promise.then (async)
./src-gen/frontend/index.js @ index.js:76
__webpack_require__ @ bootstrap:63
(anonymous) @ bootstrap:198
(anonymous) @ bootstrap:198
Show 18 more frames
preference-service.ts:263 Uncaught (in promise) Error: Unable to write to Default Settings.
    at PreferenceServiceImpl.<anonymous> (preference-service.ts:263)
    at step (preference-service.ts:15)
    at Object.next (preference-service.ts:15)
    at fulfilled (preference-service.ts:15)

OS and Theia version:

Diagnostics:

Contributor guide