Jump to content

Wikipedia:Reporting JavaScript errors: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Once you've opened the console...: usually not required, errors logged while the console was not open are visible
copyedit
Line 21: Line 21:
| Chrome || {{Key press|Ctrl|Shift|J}} || {{Key press|Option|Command|J}}
| Chrome || {{Key press|Ctrl|Shift|J}} || {{Key press|Option|Command|J}}
|-
|-
| Edge (new versions) || {{Key press|Ctrl|Shift|J}} || -
| Edge (new versions) || {{Key press|Ctrl|Shift|J}} ||
|-
|-
| Firefox || {{Key press|F12}} || {{Key press|Option|Command|K}}
| Firefox || {{Key press|F12}} || {{Key press|Option|Command|K}}
Line 27: Line 27:
| Safari || {{Key press|Ctrl|Alt|C}} || {{Key press|Option|Cmd|C}}*
| Safari || {{Key press|Ctrl|Alt|C}} || {{Key press|Option|Cmd|C}}*
|-
|-
| IE or Edge (legacy versions) || {{Key press|F12}} || -
| IE or Edge (legacy versions) || {{Key press|F12}} ||
|-
|-
| Opera || Page menu → Developer Tools → Error Console
| Opera || Page menu → Developer Tools → Error Console
Line 46: Line 46:
Unfortunately there is a lot of junk in the console. Programmers really only need one error message to debug, but the trick is getting the right error message. Here's some examples of useful error messages:
Unfortunately there is a lot of junk in the console. Programmers really only need one error message to debug, but the trick is getting the right error message. Here's some examples of useful error messages:


* Uncaught - typically red
* Uncaught typically red
** Uncaught DOMException
** Uncaught DOMException
** Uncaught Error
** Uncaught Error
Line 53: Line 53:
** Uncaught TypeError
** Uncaught TypeError
** Uncaught (something in all lowercase)<ref>[[mw:API:Main page|MediaWiki API]] error</ref>
** Uncaught (something in all lowercase)<ref>[[mw:API:Main page|MediaWiki API]] error</ref>
* jQuery exception - typically yellow
* jQuery exception typically yellow
** jQuery.Deferred exception
** jQuery.Deferred exception



Revision as of 20:28, 6 April 2023

Info to include in bug reports

When you experience an error with gadgets or user scripts and you want to report the issue at the appropriate page, please include the following information:

  1. What is the behaviour you're seeing?
  2. What is the behaviour you're expecting to see?
  3. How can the incorrect behaviour be reproduced? Describe exactly what you're doing and seeing.
  4. Confirm that you have tried bypassing your browser cache.
  5. Make note of the skin that you use, your browser, browser version, and operating system.
  6. Mention relevant JavaScript errors your browser logged. To do that, open your JavaScript console, and copy the relevant error messages. Error messages usually appear in red.

You are urged to have a look at "How to Report Bugs Effectively" by Simon Tatham for hints on how to report bugs effectively, to make sure the issue you are describing can be resolved as promptly as possible.

How to open your JavaScript console

Where to find your JavaScript console depends on your browser:

How to open the console
Browser Windows/Linux Mac
Chrome Ctrl+⇧ Shift+J ⌥ Option+⌘ Command+J
Edge (new versions) Ctrl+⇧ Shift+J
Firefox F12 ⌥ Option+⌘ Command+K
Safari Ctrl+Alt+C ⌥ Option+⌘ Cmd+C*
IE or Edge (legacy versions) F12
Opera Page menu → Developer Tools → Error Console

On some browsers, you may have to click on the "Console" tab once the developer tools pane opens up.

[*] In Safari, you might have to enable the Develop menu first in Preferences → Advanced → check "Show develop menu in menu bar". For OSX, use ⌥ Option+⌘ Command+I then hit esc (escape) to open the JavaScript console. Errors will appear in red.

Once you've opened the console...

Google Chrome DevTools, Console tab
The "triangle" can be clicked to reveal some hidden info.
  1. Click on the "Console" tab
  2. Scroll to the bottom of the console and look for log entries in yellow and red. Copy or screenshot these.
  3. If there is a "triangle" you can press to expand and show more info, do so, and copy/screenshot that info too.[1]

Which one is the error?

Unfortunately there is a lot of junk in the console. Programmers really only need one error message to debug, but the trick is getting the right error message. Here's some examples of useful error messages:

  • Uncaught – typically red
    • Uncaught DOMException
    • Uncaught Error
    • Uncaught ReferenceError
    • Uncaught SyntaxError
    • Uncaught TypeError
    • Uncaught (something in all lowercase)[2]
  • jQuery exception – typically yellow
    • jQuery.Deferred exception

See also

Notes

  1. ^ This extra info will show the stack trace, which is needed to figure out which user script and what line #.
  2. ^ MediaWiki API error