MailChimp.NET icon indicating copy to clipboard operation
MailChimp.NET copied to clipboard

Bug when unable to connect to server

Open ramoo opened this issue 11 years ago • 2 comments

ObjectNullReferenceException is thrown in MakeApiCall method in catch block when remote site is not available.

Problematic line is:

//  Throw a new exception based on this information:
throw new MailChimpAPIException(apiError.Error, ex, apiError);

but apiError is null.

Problem can be easily reproduced when you turn on firewall for outbound connections, so the remote site will be inaccessible.

ramoo avatar Mar 12 '14 13:03 ramoo

@ramoo Good call. Any suggestions?

danesparza avatar Mar 12 '14 13:03 danesparza

i am not sure, if it is good idea:

//  Throw a new exception based on this information:
if (apiError == null)
{
    throw new MailChimpAPIException(ex.Message, ex, null);
}
else
{
    throw new MailChimpAPIException(apiError.Error, ex, apiError);
}

ramoo avatar Mar 12 '14 14:03 ramoo