diff --git a/src/datascience-ui/interactive-common/cellOutput.tsx b/src/datascience-ui/interactive-common/cellOutput.tsx index ef156473ded7..e4ed9f976c29 100644 --- a/src/datascience-ui/interactive-common/cellOutput.tsx +++ b/src/datascience-ui/interactive-common/cellOutput.tsx @@ -344,7 +344,14 @@ export class CellOutput extends React.Component { if (this.isCodeCell() && this.hasOutput() && this.getCodeCell().outputs && !this.props.hideOutput) { const trim = this.props.cellVM.cell.data.metadata.tags ? this.props.cellVM.cell.data.metadata.tags[0] : ''; // Render the outputs - return this.renderOutputs(this.getCodeCell().outputs, trim); + const outputs = this.renderOutputs(this.getCodeCell().outputs, trim); + + // Render any UI side errors + if (this.props.cellVM.uiSideError) { + outputs.push(
{this.props.cellVM.uiSideError}
); + } + + return outputs; } return []; }; diff --git a/src/datascience-ui/interactive-common/mainState.ts b/src/datascience-ui/interactive-common/mainState.ts index 3f287fcc1456..b8aaca6fc131 100644 --- a/src/datascience-ui/interactive-common/mainState.ts +++ b/src/datascience-ui/interactive-common/mainState.ts @@ -40,6 +40,7 @@ export interface ICellViewModel { hasBeenRun: boolean; runDuringDebug?: boolean; codeVersion?: number; + uiSideError?: string; } export type IMainState = { diff --git a/src/datascience-ui/interactive-common/redux/reducers/commonEffects.ts b/src/datascience-ui/interactive-common/redux/reducers/commonEffects.ts index bac9f6bbd8fd..1cba73936353 100644 --- a/src/datascience-ui/interactive-common/redux/reducers/commonEffects.ts +++ b/src/datascience-ui/interactive-common/redux/reducers/commonEffects.ts @@ -224,31 +224,16 @@ export namespace CommonEffects { const newVMs = [...arg.prevState.cellVMs]; const current = arg.prevState.cellVMs[index]; - const outputs = current.cell.data.outputs as nbformat.IOutput[]; const errorMessage = arg.payload.data.isOnline ? arg.payload.data.error.toString() : getLocString( 'DataScience.loadClassFailedWithNoInternet', 'Error loading {0}:{1}. Internet connection required for loading 3rd party widgets.' ).format(arg.payload.data.moduleName, arg.payload.data.moduleVersion); - const error: nbformat.IError = { - output_type: 'error', - ename: 'Error', - evalue: errorMessage, - traceback: [] - }; - - const newVM = Helpers.asCellViewModel({ + newVMs[index] = Helpers.asCellViewModel({ ...current, - cell: { - ...current.cell, - data: { - ...current.cell.data, - outputs: [...outputs, error] - } - } + uiSideError: errorMessage }); - newVMs[index] = newVM; // Make sure to tell the extension so it can log telemetry. postActionToExtension(arg, InteractiveWindowMessages.IPyWidgetLoadFailure, arg.payload.data);