Added response status check for handndling errors