handle error response as object in login