diff --git a/src/Jupyter2Pluto.jl b/src/Jupyter2Pluto.jl index b2e0d3b..a65f2c2 100644 --- a/src/Jupyter2Pluto.jl +++ b/src/Jupyter2Pluto.jl @@ -153,9 +153,12 @@ end function jupyter2pluto(jupyter_file) jupyter_cells = try content = JSON.parsefile(jupyter_file) + if !isJupyterNotebook(content) + error("File is not Jupyter Notebook") + end content["cells"] catch ex - error("Jupyter notebook parse error") + error("Jupyter notebook parse error: ", ex) end pluto_cells = PlutoCell[] for cell in jupyter_cells @@ -295,4 +298,12 @@ function getFileName(str::AbstractString) end end +function isJupyterNotebook(content) + try + return haskey(content, "cells") && haskey(content, "metadata") + catch e + return false + end +end + end # module