mozilla

Revision 70883 of Error Console

  • Revision slug: Error_Console
  • Revision title: Error Console
  • Revision id: 70883
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment 39 words added, 2 words removed

Revision Content

The Error Console is a tool available in most Mozilla-based applications that is used for reporting errors in the application chrome and in web pages user opens. It reports JavaScript-related errors and warnings, CSS errors and arbitrary messages from chrome code.  In Firefox, the Error Console can be opened from the tools menu or by Ctrl-Shift-J.

{{ gecko_callout_heading("2.0") }}

The Error Console is disabled by default starting in Firefox 4. You can re-enable it by changing the devtools.errorconsole.enabled preference to true and restarting the browser.

Before Gecko 1.8.1 (Firefox 2), it was called JavaScript Console (see {{ Bug("265871") }}).

Types of errors

Error
usually a syntax error that prevents the program from compiling.
Warning
usually lets the program compile but warns of bad coding and suggests design flaws.
Message
very similar to warning, used very rarely.

Manipulating data displayed in Error Console

Information displayed in Error Console can be accessed and manipulated through the Console service.

Extensions can write to the Error Console from JavaScript using  Components.utils.reportError, or if you're fine with logging to the OS-provided console, dump().

To bring up Error Console from within a browser or mail window, use the function toJavaScriptConsole().

For information about what JavaScript exceptions get logged into the Error Console, and how to make all exceptions get logged, read the article Exception logging in JavaScript.

Also see Setting up extension development environment#Development preferences for other preferences you should set if you want to see errors from Firefox and extensions in the Error console.

Alternatives

Console2
This extension provides a replacement for Error Console, fixing many of its bugs and implementing long-wanted enhancement requests.
Firebug
The extension for Firefox also integrates the Error Console with various improvements.

Related Topics

JavaScript, CSS, Web Development

 

{{ languages( { "fr": "fr/Console_d\'erreurs", "ja": "ja/Error_Console", "pl": "pl/Konsola_b\u0142\u0119d\u00f3w" } ) }}

Revision Source

<p>The Error Console is a tool available in most Mozilla-based applications that is used for reporting errors in the application chrome and in web pages user opens. It reports <a href="/en/JavaScript" title="en/JavaScript">JavaScript</a>-related errors and warnings, <a href="/en/CSS" title="en/CSS">CSS</a> errors and arbitrary messages from chrome code.  In Firefox, the Error Console can be opened from the tools menu or by Ctrl-Shift-J.</p>
<div class="geckoVersionNote">
<p>{{ gecko_callout_heading("2.0") }}</p>
<p>The Error Console is disabled by default starting in Firefox 4. You can re-enable it by changing the <code>devtools.errorconsole.enabled</code> preference to <code>true</code> and restarting the browser.</p>
</div>
<p>Before <a href="/en/Gecko" title="en/Gecko">Gecko</a> 1.8.1 (<a href="/en/Firefox_2_for_developers" title="en/Firefox_2_for_developers">Firefox 2</a>), it was called JavaScript Console (see {{ Bug("265871") }}).</p>
<table class="topicpage-table"> <tbody> <tr> <td> <h4 name="Types_of_errors">Types of errors</h4> <dl> <dt>Error</dt> <dd><small>usually a syntax error that prevents the program from compiling.</small></dd> </dl> <dl> <dt>Warning</dt> <dd><small>usually lets the program compile but warns of bad coding and suggests design flaws.</small></dd> </dl> <dl> <dt>Message</dt> <dd><small>very similar to warning, used very rarely.</small></dd> </dl> <h4 name="Manipulating_data_displayed_in_Error_Console">Manipulating data displayed in Error Console</h4> <p>Information displayed in Error Console can be accessed and manipulated through the <a href="/en/Console_service" title="en/Console_service">Console service</a>.</p> <p>Extensions can write to the Error Console from JavaScript using  <code><a href="/en/Components.utils.reportError" title="en/Components.utils.reportError">Components.utils.reportError</a></code>, or if you're fine with logging to the OS-provided console, <code><a href="/en/DOM/window.dump" title="en/DOM/window.dump">dump()</a></code>.</p> <p>To bring up Error Console from within a browser or mail window, use the function <code>toJavaScriptConsole()</code>.</p> <p>For information about what JavaScript exceptions get logged into the Error Console, and how to make all exceptions get logged, read the article <a href="/en/Exception_logging_in_JavaScript" title="en/Exception_logging_in_JavaScript">Exception logging in JavaScript</a>.</p> <p>Also see <a class="internal" href="/en/Setting_up_extension_development_environment#Development_preferences" title="en/Setting up extension development environment#Development preferences">Setting up extension development environment#Development preferences</a> for other preferences you should set if you want to see errors from Firefox and extensions in the Error console.</p> </td> <td> <h4 name="Alternatives">Alternatives</h4> <dl> <dt><a class="link-https" href="https://addons.mozilla.org/firefox/addon/1815">Console<sup>2</sup></a></dt> <dd><small>This extension provides a replacement for Error Console, fixing many of its bugs and implementing long-wanted enhancement requests.</small></dd> </dl> <dl> <dt><a class="link-https" href="https://addons.mozilla.org/firefox/addon/1843">Firebug</a></dt> <dd><small>The extension for Firefox also integrates the Error Console with <a class="external" href="http://www.getfirebug.com/errors.html">various improvements</a>.</small></dd> </dl> <h4 name="Related_Topics">Related Topics</h4> <dl> <dd><a href="/en/JavaScript" title="en/JavaScript">JavaScript</a>, <a href="/en/CSS" title="en/CSS">CSS</a>, <a href="/en/Web_Development" title="en/Web_Development">Web Development</a></dd> </dl> </td> </tr> </tbody>
</table>
<p> </p>
<p>{{ languages( { "fr": "fr/Console_d\'erreurs", "ja": "ja/Error_Console", "pl": "pl/Konsola_b\u0142\u0119d\u00f3w" } ) }}</p>
Revert to this revision