show errors and messages in output (#4031)

This commit is contained in:
Chris LaFreniere
2019-02-13 14:54:51 -10:00
committed by GitHub
parent a73f5e83ec
commit db1f412dae
2 changed files with 66 additions and 23 deletions

View File

@@ -40,8 +40,12 @@ export function getData(output: nb.ICellOutput): JSONObject {
}
} else if (nbformat.isError(output)) {
let traceback = output.traceback ? output.traceback.join('\n') : undefined;
bundle['application/vnd.jupyter.stderr'] =
traceback || `${output.ename}: ${output.evalue}`;
bundle['application/vnd.jupyter.stderr'] = undefined;
if (traceback && traceback !== '') {
bundle['application/vnd.jupyter.stderr'] = traceback;
} else if (output.evalue) {
bundle['application/vnd.jupyter.stderr'] = output.ename && output.ename !== '' ? `${output.ename}: ${output.evalue}` : `${output.evalue}`;
}
}
return convertBundle(bundle);
}