title: Overriding console.error in a Create-react-app application
body: <p>I have one Create-React-App (CRA) application and I would like to override console.error method because there are some errors from a third-party library that I do not want to see it.</p>
  <p>I have tried this code with no luck:</p>
  <pre><code>const orig = console.error;
  console.error = function() {
      var msgs = [];
      while(arguments.length) {
          msgs.push([].shift.call(arguments));
      }
      // From here I try to debug my new function without success.
      orig.apply(console, msgs);
  };
  </code></pre>
  <p>Inspiration here: <a href="https://gist.github.com/pincheira/2724082" rel="nofollow noreferrer">https://gist.github.com/pincheira/2724082</a></p>
  <p>Suddenly I tried to sniff window.onload event, but I am not able to stop the propagation of this event when I want to stop it:</p>
  <pre><code>window.onerror = (msg, src, lineno, colno, error) =&gt; {
      // Not our business
      const nob = srcErrorMsgs.some((i) =&gt; src?.includes(i));
      if (nob) return undefined;
  };
  </code></pre>
  <p>Of course, I run these functions from my index.ts.</p>
  <p>I think CRA is doing some extra implementation because I have never had those kinds of problems in my life.</p>