handle err in resp first