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 6194449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:17:54+00:00 2026-05-24T03:17:54+00:00

I am writing a Windows Sidebar Gadget using JavaScript. Now I would like to

  • 0

I am writing a Windows Sidebar Gadget using JavaScript. Now I would like to have all JavaScript exceptions caught and logged to a text file. One problem is that when an exception is thrown at any line, the next line will not be executed. Is it possible to catch exceptions automatically so that the following line of JavaScript can be executed.

Here is the sample code which demonstrates my problem:

try
{
    alert(document.getElementById("non-existing-element").value);
}
catch(ex)
{
}
alert("This is shown.");
alert(document.getElementById("non-existing-element").value);
alert("This is not shown.");

So one big try-catch-method whould allow to log the error but the rest of the code would not be executed.
One solution would be to catch errors for every line. But would be too much code for several thousand lines. (or I write a macro which does this for me)
Maybe anyone can help me.

Thank you.

  • 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-05-24T03:17:55+00:00Added an answer on May 24, 2026 at 3:17 am

    Instead of trying to catch errors, you should be trying to build proper logic to control them.

    var myEle = document.getElementById("non-existing-element")
    
    if (myEle != null)
       alert(dmyEle.value);
    

    But you are describing suppressing errors

    You can suppress error in JavaScript with a onerror event handler.

    function handleErr(msg, url, line_no){ 
       var errorMsg = "Error: " + msg + "\n"; 
           errorMsg += "URL: " + url + "\n"; 
           errorMsg += "Line: " + line_no + "\n\n"; 
    
        alert(errorMsg); 
    
     return true;
    } 
    
    // Set the global onerror; 
    onerror = handleErr;
    

    More information here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're writing Windows desktop apps using C++ and Win32. Our dialog boxes have an
I'm writing a Windows version of my Mac app (C# Winforms) and would like
I'm writing a Windows console application in C++ and would like to return zero
I am writing a windows application in Lazarus/FreePascal (like Delphi). I have a TDataset
I'm writing a windows application using VS2010 and C# 4.0. I have a MDI
I'm writing a Windows Forms app in C#, using Visual Studio 2010. It has
I'm writing a Windows GUI app and I have come on the need to
I'm using visual stduio 2008 c++. And I'm writing windows form application. I declare
I'm writing a windows service to consume MSMQ messages. The service will have periods
I'm writing windows program with C and Visual Studio. I have to map a

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.