Skip to content

Commit f7a4437

Browse files
fix: do not show error from preview initialization when stop is called
When preview is called with webpack from Public API, if you stop the livesync (via stopLiveSync method) while webpack is still working, in the output you'll see an error as webpack's child process exits with `null` exit code. However, this error does not have any meaning for the user, so we shouldn't raise it. Move the logging of the error to LiveSyncService's handler of `previewAppLiveSyncError` event - in the described case it will not be raised as LiveSyncService had already removed all listeners.
1 parent 0842ab6 commit f7a4437

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

lib/services/livesync/livesync-service.ts

+1
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ export class LiveSyncService extends EventEmitter implements IDebugLiveSyncServi
140140
@cache()
141141
private attachToPreviewAppLiveSyncError(): void {
142142
this.$previewAppLiveSyncService.on(LiveSyncEvents.previewAppLiveSyncError, liveSyncData => {
143+
this.$logger.error(liveSyncData.error);
143144
this.emit(LiveSyncEvents.previewAppLiveSyncError, liveSyncData);
144145
});
145146
}

lib/services/livesync/playground/preview-app-livesync-service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export class PreviewAppLiveSyncService extends EventEmitter implements IPreviewA
4343
this.deviceInitializationPromise[device.id] = null;
4444
}
4545
} catch (error) {
46-
this.$logger.error(error);
46+
this.$logger.trace(`Error while sending files on device ${device && device.id}. Error is`, error);
4747
this.emit(PreviewAppLiveSyncEvents.PREVIEW_APP_LIVE_SYNC_ERROR, {
4848
error,
4949
data,

0 commit comments

Comments
 (0)