What's the term for an error caused by executing a block of code before its relevant ajax response has come back? e.g., a timeline:

13:00:01 execute getDataViaAjax();

13:00:02 execute doSomethingWithMyAjaxData();

13:00:03 ajax data comes back, too late since I forgot to make the code wait for it...

I have a feeling I may say "doh!" when someone tells me the answer, but I can't for the life of me think what type of error it might be called.

  • I call that a timeout. If it is being caused by an internal problem with the program, then it's a bug, not a timeout. – Neil Jan 8 '14 at 17:39
  • 2
    Premature Ajaxulation? – Hellion Jan 8 '14 at 19:03
  • 2
    This question appears to be off-topic because it is a "name that thing" question. "Name that thing" are bad questions for the same reasons that "identify this obscure TV show, film or book by its characters or story" are bad questions: you can't Google them, they aren't practical in any way, they don't help anyone else, and allowing them opens the door for the asking of other types of marginal questions. See blog.stackoverflow.com/2012/02/lets-play-the-guessing-game – Bart van Ingen Schenau Mar 24 '14 at 13:32

It's simply called an asynchronous error since this relates to incorrect asynchronous behavior.

The data was managed in a synchronous fashion when it's the result of an asynchronous event. So the handler function executed before another function finished.

Asynchronous Error

What is asynchronous programming? It's defined as a one-way operation. Which means code sends a signal one-way into an object and there is no immediate signal sent back. So either it's a black-hole or you attach a handler to listen for a signal to come out later.

What is an asynchronous error? It is a problem with how the object triggers handlers for the one-way signal. They could be fired to soon, to late or not at all.

Synchronous Error

What is synchronous programming? It's defined as a two-way operation. Code sends a signal into an object and the object sends a response signal back.

What is a synchronous error? It's an error related to the two-way signals that define a synchronous operation. For example; a web browser connects to a web server, and the web server send a HTTP response before the web browser sends a HTTP request.

Synchronization Error

Synchronization error is what happens when two objects fail to achieve the same equal state. Think of synchronizing two databases on a fail-over server. If the second machine doesn't keep it's database identical to it's master, then it's a synchronization error.

| improve this answer | |
  • I debated this term before posting... 'asynchronous error' sounds like the error happens in an asynchronous manner, rather than simply being an error with asynchronous code, if that distinction makes sense. – StackExchange What The Heck Jan 8 '14 at 16:31
  • 2
    @yochannah: Then how about the term "synchronization error"? – FrustratedWithFormsDesigner Jan 8 '14 at 16:49
  • @yochannah well, if doSomethingWithMyAjaxData is called via an event handler for the AJAX call, then it's a Asynchronous Error cause it happened to soon, or the programmer used getDataViaAjax as a synchronous method expecting the data returned as output, but it's an async method. So it's not an error it's a bug. See my edit above. – Reactgular Jan 8 '14 at 18:42
  • it could also be called a race condition, but that might be contrived. – Steve Jan 8 '14 at 23:27

Not the answer you're looking for? Browse other questions tagged or ask your own question.