OctoPrint / OctoPrint

OctoPrint is the snappy web interface for your 3D printer!
https://octoprint.org
GNU Affero General Public License v3.0
8.31k stars 1.67k forks source link

[Request] Display if JavaScript errors #2887

Open OutsourcedGuru opened 5 years ago

OutsourcedGuru commented 5 years ago

Feature Request

As someone who helps others to troubleshoot their OctoPrint installation, it would be nice if they had some early warning of JavaScript errors.

Certainly, I can try to talk them through the process of visiting their browser's Developer's Console to look for these errors but sometimes for the new people, they don't understand.

The new undervoltage indicator in the upper menu area is similar to what I'm suggesting. Perhaps a visual Yield sign indicator (if JavaScript errors were seen) could be somehow bubble up to the menu.

Hovering over the Yield sign indicator would include a suggestion to check for errors in the Console log.

Yield sign

How do JavaScript errors affect users?

In most browsers, when a JavaScript error is seen in the bundled JavaScript code (from the plugin collection), it just stops running at this point.

The unfortunate side-effect then is that important functionality like the CLOSE/SAVE buttons at the bottom of the Settings dialog box are victims to small errors as seen above.

Incremental fix

Perhaps moving the button binding for these two buttons so that they occur before the bundled plugins JavaScript could be better (or possibly not since some of the functionality is potentially missing). And yet, it might help other features that are unnecessarily affected. ("One bad apple spoils the bushel.")

Did the same happen when running OctoPrint in safe mode?

Almost always, the problem is in a third-party plugin so it would work of course for the user.

Link to contents of Javascript console in the browser

Is is possible to copy JavaScript errors to the octoprint.log? Or better, could they be copied to a new log file called javascript-errors.log?

What were you doing?

N/A

What did you expect to happen?

N/A

What happened instead?

N/A

Version of OctoPrint

1.3.10rc1

Operating System running OctoPrint

Raspian

Printer model & used firmware incl. version

Robo C2, Marlin C2

Browser and version of browser, operating system running browser

Safari 12.0.1, OSX 10.14.1

Link to octoprint.log

N/A

Link to contents of terminal tab or serial.log

N/A

Link to contents of Javascript console in the browser

N/A

Screenshot(s)/video(s) showing the problem:

N/A I have read the FAQ.

GitIssueBot commented 5 years ago

Hi @OutsourcedGuru,

It looks like there is some information missing from your bug report that will be needed in order to solve the problem. Read the Contribution Guidelines which will provide you with a template to fill out here so that your bug report is ready to be investigated (I promise I'll go away then too!).

If you did not intend to report a bug but wanted to request a feature or brain storm about some kind of development, please take special note of the title format to use as described in the Contribution Guidelines.

Please do not abuse the bug tracker as a support forum - that can be found at discourse.octoprint.org. Go there for any kind of issues with network connectivity, webcam functionality, printer detection or any other kind of such support requests or general questions.

Also make sure you are at the right place - this is the bug tracker of the official version of OctoPrint, not the Raspberry Pi image OctoPi nor any unbundled third party OctoPrint plugins or unofficial versions. Make sure too that you have read through the Frequently Asked Questions and searched the existing tickets for your problem - try multiple search terms please.

I'm marking this one now as needing some more information. Please understand that if you do not provide that information within the next two weeks (until 2018-11-26 17:40 UTC) I'll close this ticket so it doesn't clutter the bug tracker. This is nothing personal, so please just be considerate and help the maintainers solve this problem quickly by following the guidelines linked above. Remember, the less time the devs have to spend running after information on tickets, the more time they have to actually solve problems and add awesome new features. Thank you!

Best regards, ~ Your friendly GitIssueBot

PS: I'm just an automated script, not a human being, so don't expect any replies from me :) Your ticket is read by humans too, I'm just not one of them.

foosel commented 5 years ago

I was actually thinking about something like even forwarding the JS console to either octoprint.log or another server side js.log or something like this, to make it easier to access it in the future. Not sure yet though how best to go about it, haven't yet had time to look into possible libraries or general approaches for that.

BillyBlaze commented 5 years ago

What about introducing a library like loglevel and use the plugin loglevel-plugin-remote?

foosel commented 5 years ago

Ooooh, I wasn't aware of that plugin. I already use loglevel :)

Would need some "catchall" thing too though. Last time I checked that seemed to still be a bit iffy depending on the browser, but that was two or three years ago, so things might have changed.

OutsourcedGuru commented 5 years ago

Take a look at this: OctoPrint-ConsoleLog.

I'm not completely convinced that a plugin is the way to go on this. Overclassing the console log should probably be done at the top of the packed third-party plugins' JavaScript and then reporting should probably happen at the end of that stack. Presumably that would be the best way of capturing all the errors.