File tree Expand file tree Collapse file tree 1 file changed +22
-12
lines changed
lib/services/livesync/playground Expand file tree Collapse file tree 1 file changed +22
-12
lines changed Original file line number Diff line number Diff line change @@ -26,20 +26,30 @@ export class PreviewAppLiveSyncService extends EventEmitter implements IPreviewA
2626
2727 public async initialize ( data : IPreviewAppLiveSyncData ) : Promise < void > {
2828 await this . $previewSdkService . initialize ( async ( device : Device ) => {
29- if ( ! device ) {
30- this . $errors . failWithoutHelp ( "Sending initial preview files without a specified device is not supported." ) ;
31- }
29+ try {
30+ if ( ! device ) {
31+ this . $errors . failWithoutHelp ( "Sending initial preview files without a specified device is not supported." ) ;
32+ }
3233
33- if ( this . deviceInitializationPromise [ device . id ] ) {
34- return this . deviceInitializationPromise [ device . id ] ;
35- }
34+ if ( this . deviceInitializationPromise [ device . id ] ) {
35+ return this . deviceInitializationPromise [ device . id ] ;
36+ }
3637
37- this . deviceInitializationPromise [ device . id ] = this . getInitialFilesForDevice ( data , device ) ;
38- try {
39- const payloads = await this . deviceInitializationPromise [ device . id ] ;
40- return payloads ;
41- } finally {
42- this . deviceInitializationPromise [ device . id ] = null ;
38+ this . deviceInitializationPromise [ device . id ] = this . getInitialFilesForDevice ( data , device ) ;
39+ try {
40+ const payloads = await this . deviceInitializationPromise [ device . id ] ;
41+ return payloads ;
42+ } finally {
43+ this . deviceInitializationPromise [ device . id ] = null ;
44+ }
45+ } catch ( error ) {
46+ this . $logger . error ( error ) ;
47+ this . emit ( PreviewAppLiveSyncEvents . PREVIEW_APP_LIVE_SYNC_ERROR , {
48+ error,
49+ data,
50+ platform : device . platform ,
51+ deviceId : device . id
52+ } ) ;
4353 }
4454 } ) ;
4555 }
You can’t perform that action at this time.
0 commit comments