alabid / flylatex

FlyLatex: A Realtime Collaborative Environment (with a concurrent editor) in node-js.
766 stars 85 forks source link

Print error details if an error occurs during compilation #36

Closed ulikoehler closed 10 years ago

ulikoehler commented 10 years ago

I'm currently having some severe issues trying to get flylatex to run behind an NGinx reverse proxy on my VPS.

When trying to compile, the application just crashes -- I tracked down the bug, it's because of (IMO) incorrect behaviour of fs-extra, see https://github.com/jprichardson/node-fs-extra/pull/38 .

However, even after I fixed it, I didn't find the flylatex error messages very helpful -- no detailed error message was console-logged, and the webinterface also printed only "An error occured before or during compilation", without any details.

This PR fixes this by console-logging errors and by printing the error details on the web interface.

ulikoehler commented 10 years ago

I hope you don't mind if I added another feature in the same pull request (--> there's no need to merge intersecting changes), this one adds a fs.exists-check on the PDF output file to produce a better error message if LaTeX just failed compilation.

ulikoehler commented 10 years ago

The node-fs-extra pull request has now been merged. I'll submit another pull request to update the node-fs-extra dep to the latest version.

EDIT: Ah, sorry, missed that you specified a dep version wildcard. I'm not entirely sure if this is a good idea in the long term, but at least for now it spares anyone from manually updating versions all the time

ulikoehler commented 10 years ago

Sorry for self-bumping, but I'd be grateful if you could review and merge this!

alabid commented 10 years ago

Hey @ulikoehler , thanks for the pull request but not everyone wants to see errors or error types in the console. Initially, all errors were being sent to STDOUT. But after a while (and some complaints about too much logging), only the most crucial errors were being displayed. Also, whenever the error "An error occured before or during compilation" occurs, there's information about the error in the compilation logs (See View Logs). Besides, errors on the console can be seen by the administrator but not necessarily by the users. So the logs are more helpful after all.

ulikoehler commented 10 years ago

@alabid Thanks for your feedback. When I started using flylatex however, it wouldn't work and had numerous bugs. Until now, it was not possible to even show a PDF appropriately. Besides that, flylatex left a pile of tmpdirs in /tmp that weren't cleaned up properly. I adressed some of the issues in my pull requests, even if they didn't solve all the problems. One of the aspects why it was really, really hard to debug is because of logging not being done. Please use a proper logging framework (there are many of them, I sometimes use log4js) instead of preventing anyone from debugging the code instead of errors. You can then set the loglevel instead of simply omitting to log it (even if I would always enable error logging on the console, especially for system errors, whereas LaTeX errors should probably be warnings).

Please note that because of these and other severe issues with flylatex that would have taken weeks to figure out, including the collaborative text editing component being not even close to what EPLite can do, I developed my own, lightweight alternative as an EPLite plugin: https://github.com/ulikoehler/ep_etherlatex

This might not suit all usecases, but IMO it solves all the major issues with flylatex at the moment:

Caveats:

I hope you understand that even if I liked to use flylatex, I only scratched the surface of bugfixes and caveats, because I needed something that just works(TM), in limited time, of course. Hopefully FlyLaTeX will be more robust and debuggable in the future.