infobip / infobip-api-csharp-client

Infobip API client library in C#, distributed as a NuGet package.
https://www.infobip.com/docs/api
MIT License
11 stars 17 forks source link

SendSmsMessageAsync parsing exception #29

Closed BluMichele closed 8 months ago

BluMichele commented 8 months ago

Hi,

I've copied the code from the simple example that sends messages from a sandbox env, but I changed SendSmsMessage to SendSmsMessageAsync and now I get Unexpected character encountered while parsing value: <.

Infobip.Api.Client.ApiException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0.
   at Infobip.Api.Client.CustomJsonCodec.DeserializeAsync(HttpResponseMessage response, Type type)
   at Infobip.Api.Client.CustomJsonCodec.DeserializeAsync[T](HttpResponseMessage response)
   at Infobip.Api.Client.ApiClient.ExecAsync[T](HttpRequestMessage req, IReadableConfiguration configuration, CancellationToken cancellationToken)
   at Infobip.Api.Client.Api.SendSmsApi.SendSmsMessageWithHttpInfoAsync(SmsAdvancedTextualRequest smsAdvancedTextualRequest, CancellationToken cancellationToken)
   at Infobip.Api.Client.Api.SendSmsApi.SendSmsMessageAsync(SmsAdvancedTextualRequest smsAdvancedTextualRequest, CancellationToken cancellationToken)
mateanticevic commented 8 months ago

Hi Michele,

Can you provide the code snippet so we can try to reproduce the issue?

BluMichele commented 8 months ago

I'm sorry, my mistake, I passed the default configuration, you can close the issue, the only thing I can complain about is the lack of clarity of the error, a better hint would have been like "Missing API key" or "Missing BasePath". Thanks for your patience.

mateanticevic commented 8 months ago

Yes, we could handle these exceptions in a better way, good point. However, I'm not sure how exactly you got the one above. I wasn't able to replicate it, even when not providing the API key or base path.