lalalic/docx2html

How to edit the source to trap unhandled errors?

jumpjack opened this issue · 1 comments

I have a very complex document which raises many errors which are not managed by docx2html, which just stops without any warning, for example:

..\docx4js\src\openxml\docx\document.js:9 Uncaught (in promise) TypeError: Cannot read property 'documentElement' of null
at document.parse (..\docx4js\src\openxml\document.js:28)
at document.parse (..\docx4js\src\openxml\docx\document.js:9)
at ..\src\index.js:6

I am a javascript developer, but not a Node.js developer, and usual methods that I use to debug a javascript code do not work for docx2html: opening console, looking at error messages, clicking on the referred .js files, examining them, putting linebreaks and using local overrides to make changes and test.
I would like to add some error messages any time docx2html crashes, to avoid crashing and to warn me next times. How can I do it?

In above error I see it is referred "..\docx4js\src\openxml\docx\document.js", which actually maps to "file:///C:/MYPATH/docx2html/dist/..\docx4js\src\openxml\docx\document.js"... but there is no "docx4js" folder in my installation of doc2xhtml, so where does the browser look for docx4js, and why aren't its source shown in "Sources" tab of Chrome?

main file is specified in package.json, so you can use source map in your project. please try latest