Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I just use:

    if ( errror ) {
        try { console.error(msg); }
        catch(e) {};
    }
Of course I do all of my debugging in Firefox with Firebug, and my goal is to ensure that these errors don't happen in production code so other browsers never hit the try/catch block. In rare cases where an error only happens in IE, I can throw an alert into the catch.


Its terrible practice to catch an error and do nothing with it.


Generally yes, I agree. But in this case all I'm doing with the error is displaying it to the programmer, and it doesn't matter to me if the programmer has to be using Firefox to see it. We were talking about displaying debugging messages and dealing with a missing console, not handling application failures.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: