Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8795639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:25:59+00:00 2026-06-13T23:25:59+00:00

Since systems these days are becoming more and more Javascript (jQuery, AJAX, etc) oriented,

  • 0

Since systems these days are becoming more and more Javascript (jQuery, AJAX, etc) oriented, we’ve been trying to get more and more Error logging happening for any of these things.


My concern is that within jQuery itself, when normal DOM manipulation / jQuery events are created or executed, window.onerror is unable to catch these, and this might help make debugging bugs in production faster, by having them logged on a server

In this article from 2008 (.onerror & jQuery bind try/catch{}), they add a try/catch {} to the jQuery.bind() event and even the document.ready event. Now that everything goes through the .on() event this article is a bit dated, but I feel like logic could still work…

Has anyone tried implementing such a jQuery overwrite (try/catch system) into their own Projects?

Basically I want to continue using jQuery from the CDN, and just within one of our JS files – extend/override the .on() / $(document).ready() / etc events with these changes.

jQuery.fn.extend({ // <-- can this be extended / overwritten ?
    on: function(etc etc) {
        // same code just add the additional
        try {
            // try to execute the original .on()
        }
        catch (ex) {
            // log any errors / info (where/why/etc)
        }
    }
});

// or even some sort of try/catch for $(document).ready()?

The other typical error logging formats: (of course logging browser/OS/QueryString/etc too)

window.onerror = function (msg, url, line) {
    // Log General Javascript Errors
    // this won't log jQuery internal errors
};

$.ajaxSetup({ // Log AJAX Errors
    error: function (jqXHR, ajaxSettings, thrownError) { }
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T23:25:59+00:00Added an answer on June 13, 2026 at 11:25 pm

    We report JavaScript errors to the server in window.onerror and jQuery ajax errors, without overriding jQuery and it works well. If you want to override a jQuery function, you can do:

    $.fn.oldOn = $.fn.on;
    $.fn.on = function(a,b,c,d,e,f) {
        try {
            $(this).oldOn(a,b,c,d,e,f);
        }
        catch (ex) { ... }
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Brief Description : Well, since many days I've been looking for an answer to
Does Windows XP (and up) store how long it has been... ...since the system
Since regular jQuery animations are not fluent on iOS ( .hide() , slideDown() ),
Since I am developing an iOS >= 5.0 application, I am trying to change
This question brings me back to my college days, but since I haven't coded
I have been using Emacs since version 18. Emacs Lisp isn't my routine programming
These days I am reading a document about stack overflow and found one sentence
We're currently using Salesforce for our sales process, which involve trying to get people
I've got a sizable Qt app that has been in development since the Qt
Since a few days ago, MySQL server on my Windows machine was not successful

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.