That is a pretty niche feature, I personally wouldn't do something like that.
Check out getResponseHeader() if you are so inclined.
As for the errors, there are many ways to check for "ajax" errors, for one thing you can check the status or statusText property.