0

I'm trying to develop this website where I sign up to firebase. Everything is working but I'm getting this post in my console that looks a lot like a error message but is not really one.

The Post im trying to remove/block

I want to block this "post" from getting out into the console, but just cant get it right. I know where it is getting posted from, but I can't catch it as it is not an error. I have also tried the function which stops all errors from getting posted and it acts like nothing is there.

 <script type="text/javascript">
window.onerror = function(message, url, lineNumber) {
 
    return true; // prevents browser error messages
};

I am aware there is also the console.clear(); but that clears the some other stuff I want to be printed out (console.log stuff).

    signInWithEmailAndPassword(email, password){
    return firebase.auth().signInWithEmailAndPassword(email, password)
        .then((userCredential) => {
            var user = userCredential.user;
 
        }).then(response=> response.status === 200 ? response :
            doThrow(new Error("Status was: " + response.statusText + " " + response.status)))
        .then(response => {response.json(); console.log(response.status)
        }).catch((error) => {
            this.errorCode = error.code;
            this.errorMessage = error.message;
        });
    }
Fprogramer
  • 63
  • 7
  • Welcome to Stack Overflow! Please take the [tour](https://stackoverflow.com/tour). For debugging help, you need to make a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) including complete but minimal code and expected behaviour. You can [edit](https://stackoverflow.com/posts/70384330/edit). For more tips, see [How to Ask](https://stackoverflow.com/help/how-to-ask). – Sercan Dec 16 '21 at 19:13
  • 1
    The third answer on this question might help you: https://stackoverflow.com/questions/21549139/hide-errors-and-warnings-from-console – Grant Thomas Dec 16 '21 at 19:16
  • 1
    The browser always logs these errors even if the code catches them. – Barmar Dec 16 '21 at 19:20
  • @Barmar , well it aint realy a error. Thats the problem here, or the window.onerror would work – Fprogramer Dec 16 '21 at 20:20
  • @GrantThomas Sadly did not work, might have just used it wrong but when i implemented it in my HTML file the program I get the error "Uncaught DOMException: Failed to execute 'send' on 'XMLHttpRequest': The object's state must be OPENED." and my page craches. – Fprogramer Dec 16 '21 at 20:26
  • Does this answer your question? [Suppress Chrome 'Failed to load resource' messages in console](https://stackoverflow.com/questions/4500741/suppress-chrome-failed-to-load-resource-messages-in-console) – zero298 Dec 16 '21 at 20:47
  • The goal is to block the user from seeing the "error" message. So if I only disable it from my side the goal is not achieved – Fprogramer Dec 17 '21 at 12:49

0 Answers0