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

  • Home
  • SEARCH
  • 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 3624282
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T23:29:18+00:00 2026-05-18T23:29:18+00:00

So take a look at the below rough code: function Manager() { try {

  • 0

So take a look at the below rough code:

    function Manager()
{
    try
    {
        A();
    }
    catch(e)
    {
        //......Never caught...
    }

}

function AjaxCallback()
{
    try
    {
        B();
    }
    catch(e)
    {
        throw e;
    }
}

function B()
{
    throw {//something here}
}

I am able to catch the exception in my callback function when thrown from B fine. However, when I rethrow that same error in the callback, it’s never caught in the manager. Why? Regardless of the fact that the callback can execute whenever, it’s chain here still seems to dictate that the error should bubble back up and caught by manager although as stated, this does not happen. Can anyone explain to me why this is and maybe how to fix this?

  • 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-18T23:29:19+00:00Added an answer on May 18, 2026 at 11:29 pm

    The callback is invoked asynchronously. There’s “nobody home” listening for exceptions when the callback is called. The browser invokes the callback in response to the asynchronous event of the HTTP request completing. Your try ... catch block is a static construct, and as such it won’t play any role in the handling of exceptions thrown by your callback function. The try ... catch is executed synchronously, and it’s a thing of the past by the time the callback function happens. Thus, you can’t catch an exception that way; it just doesn’t make any sense.

    What you can do instead is to set up your Ajax stuff such that when you decide it’s time to contact the server, you provide the code necessary to make the request and the code you want to run when the request is successful, and the code to run when the request fails. Exactly how you do that depends on the Ajax mechanism you’re using.

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

Sidebar

Related Questions

Take a look at the code below. Here I create a thread, set its
take a look at this code: $(document).ready(function() { document.getElementById(sliderId).onmousedown = sliderMouseDown; }); function sliderMouseDown()
Please take a look at this below line of code in JSF <h:inputText id=name
Hey everyone, take a look at the code below and appreciate how messy the
Take a look on the code below: $t=77; date(H:i:s, $t); It returns 21:01:17 The
If you take a look at the code below you can see that I
Very simple question. Take a look at the code below. It's a very simple
Take a look at this snippet below: <script> $(function(){ var to_username = alex; window.Persona
Take a look at the image below. I defined the red boxes inside the
Please take a look at the html listed below and let me know why

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.