A Palm project uses Prototype for their ajax calls. They noticed that Prototype casts low-level errors (network errors, etc.) to a response code of 0. Unfortunately, the rest of Prototype interprets 0 as “success”. When they hacked Prototype to interpret 0 as a failure, another darker problem emerged. In some cases, for example if they send two requests in rapid succession, even if both responses have 200 in their headers, Prototype will report the second’s response code as 0. So, 0 can indicate success or failure in different scenarios.
SF Standup 3/3/2010: Disappearing response codes
Wednesday, March 3, 2010