Show an error in cell output when trying to load an unsupported output type. (#19693)

This commit is contained in:
Cory Rivera
2022-06-09 12:32:42 -07:00
committed by GitHub
parent fc7a27171d
commit a265224701
3 changed files with 22 additions and 3 deletions

View File

@@ -155,8 +155,8 @@ namespace v4 {
traceback: output.traceback
};
default:
// Should never get here
throw new TypeError(localize('unrecognizedOutput', "Output type {0} not recognized", (<any>output).output_type));
// Unknown type, so return as is. If it's unsupported, then an error will be shown later when trying to render it.
return output;
}
}
@@ -272,6 +272,7 @@ namespace v3 {
name: name,
text: v4.demultiline(output.text)
};
case 'error':
case 'pyerr':
return <nb.IErrorResult>{
output_type: OutputTypes.Error,
@@ -280,7 +281,8 @@ namespace v3 {
traceback: output.traceback
};
default:
throw new TypeError(localize('unrecognizedOutputType', "Output type {0} not recognized", output.output_type));
// Unknown type, so return as is. If it's unsupported, then an error will be shown later when trying to render it.
return output;
}
};