fix exception if response is not successful

Thank you @nqtien310 I will fix