File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
packages/app/src/app/overmind/effects/vscode Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change 11import JSON5 from 'json5' ;
22import codeSandboxTheme from '@codesandbox/common/lib/themes/codesandbox.json' ;
33import codeSandboxBlackTheme from '@codesandbox/common/lib/themes/codesandbox-black' ;
4+ import { notificationState } from '@codesandbox/common/lib/utils/notifications' ;
5+ import { NotificationStatus } from '@codesandbox/notifications' ;
46
57export function initializeThemeCache ( ) {
68 try {
@@ -174,7 +176,25 @@ export function initializeCustomTheme() {
174176 const customTheme = localStorage . getItem ( 'settings.manualCustomVSCodeTheme' ) ;
175177
176178 if ( customTheme ) {
177- installCustomTheme ( 'custom' , 'Custom Theme' , JSON . parse ( customTheme ) ) ;
179+ try {
180+ installCustomTheme ( 'custom' , 'Custom Theme' , JSON . parse ( customTheme ) ) ;
181+ } catch ( e ) {
182+ notificationState . addNotification ( {
183+ title : 'Something went wrong while installing the custom extension' ,
184+ message : e . message ,
185+ status : NotificationStatus . ERROR ,
186+ actions : {
187+ primary : [
188+ {
189+ label : 'Clear Custom Theme' ,
190+ run : ( ) => {
191+ localStorage . removeItem ( 'settings.manualCustomVSCodeTheme' ) ;
192+ } ,
193+ } ,
194+ ] ,
195+ } ,
196+ } ) ;
197+ }
178198 }
179199}
180200
You can’t perform that action at this time.
0 commit comments