$.ajax's error callback: Confusion with status codes and dataType

$.ajax's error callback: Confusion with status codes and dataType


Can someone explain me the reasoning that if a dataType is specified
as JSON and the response code is say a 204 (NO CONTENT), that it would
error. The way it looks, the code is expecting JSON back, but since
there is no JSON, it fails.
The documentation however says that error is "A function to be called
if the request fails." - Which makes me think that the actual request
fails, not that the data parsed failed.
Maybe it's me, but it seems a bit confusing.