handleBatchResult detects errors by checking both statusCode and atom+xml response.
On error, an Error object is passed to callback.
Added Error type.