Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function _loadNotebook(filename: string) {
let data;
let nb;
try {
data = await readFileP(filename);
nb = parseNotebook(data);
} catch (err) {
if (err.name === "SyntaxError") {
atom.notifications.addError("Error not a valid notebook", {
detail: err.stack
});
} else {
atom.notifications.addError("Error reading file", {
detail: err.message
});
}
return;
}
if (nb.nbformat < 4) {
atom.notifications.addError("Only notebook version 4 currently supported");
return;
}