travs / markdown-pdf

Convert markdown to pdf, png or jpeg on the fly in Atom
MIT License
263 stars 44 forks source link

Misleading error when trying to convert from a non-editor pane #227

Closed travs closed 4 years ago

travs commented 4 years ago

It makes sense to error here, but a good message should be displayed to the user instead of this:

convert.js? [sm]:111 TypeError: Cannot read property 'getPath' of undefined
    at Object.<anonymous> (fallback.js:18)
    at Generator.next (<anonymous>)
    at step (fallback.js:28)
    at fallback.js:28
    at new Promise (<anonymous>)
    at Object.convert (fallback.js:28)
    at Object.<anonymous> (convert.js? [sm]:56)
    at Generator.next (<anonymous>)
    at step (/home/travis/prg/mar…ctions/convert.js:7)
    at /home/travis/prg/mar…ctions/convert.js:7
    at new Promise (<anonymous>)
    at Object.convert (/home/travis/prg/mar…ctions/convert.js:7)
    at HTMLElement.markdownPdfConvert (markdown-pdf.js? [sm]:6)
    at CommandRegistry.handleCommandEvent (/usr/lib/atom/src/co…and-registry.js:405)
    at Object.didConfirmSelection (command-palette-view.js:77)
    at SelectListView.confirmSelection (/usr/lib/atom/node_m…ct-list-view.js:400)
    at HTMLDivElement.core:confirm (/usr/lib/atom/node_m…ct-list-view.js:105)
    at CommandRegistry.handleCommandEvent (/usr/lib/atom/src/co…and-registry.js:405)
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/usr/lib/atom/node_m…ymap-manager.js:617)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/usr/lib/atom/node_m…ymap-manager.js:408)
    at WindowEventHandler.handleDocumentKeyEvent (/usr/lib/atom/src/wi…vent-handler.js:153)