srcnalt / OpenAI-Unity

An unofficial OpenAI Unity Package that aims to help you use OpenAI API directly in Unity Game engine.
MIT License
672 stars 150 forks source link

Handle error in async void DispatchRequest #62

Open RemiDrouot opened 1 year ago

RemiDrouot commented 1 year ago

Hi,

I found some issues when request.downloadHandler.text retrieve an error message.

Because the lines retrieved are like that ErrorMessageHandle

and after you try to convert them with: var data = JsonConvert.DeserializeObject(value, jsonSerializerSettings); But this give a error exception because the json format is not correct.

I have done some changes to fix this https://codefile.io/f/HWLrBZPdhh

Tell me if it's look good for you my fixes.