TransWikia.com

In Chrome/Firefox Developer Tools, is it Possible to Hide All But the First Two Errors? (Since React Gives LOTS of Garbage Errors)

Stack Overflow Asked by machineghost on January 25, 2021

In React when things go wrong you often wind up with A LOT of error messages in your console. Some can be duplicates of the original error, and some are unrelated errors caused by the original error creating invalid conditions.

In a normal JS app this happens, just less often, because the first error generally halts code execution. But in React, its rendering strategy often results in new errors after existing ones (and often they’re quite verbose).

Thus, you often have a wall of text to scroll back up through on every refresh, when you actually need just: A) the original error, and/or B) the message React throws right after (ie. where that error actually occurred).

My question is:

Is it possible to configure any browser’s dev tools to collapse or hide error messages after the first two (since reloading)?

Can I use a configuration option, or an extension, or a global error handler that calls a console function I don’t know of, or something … to automatically make it so I only see the first two on reload?

One Answer

Only showing first n errors/warning is not possible from the developer tools at least for Chrome 86.0.4240.75 or earlier.

If you want to create your own plugin, you can for sure achieve this!, but there are multiple things you can try to keep unnecessary logs filtered from the console.

For example, you can decide what level og messages you want to see: enter image description here

or filter messages by text or regex from filter box enter image description here

or filter messages from a particular file: enter image description here

Learn more about log filtering from official guide.

Correct answer by Dipen Shah on January 25, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP