You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Could you advise on how you'd propose users of this library handle errors in API calls with try/catch blocks?
For example - I'd rather not have to use the RegistrationExists() call before calling the GetLaunchHistory() to avoid making 2 API calls instead of one. So, if I call GetLaunchHistory and the registrationId I use is not found/invalid, I'd rather it fall into the try/catch and just keep moving on. Would you advise for or against this approach?
Here's a snippet of how I might try altering the GetLaunchHistory call - is this a bad idea or ok with you?
public List<LaunchInfo> GetLaunchHistory(string registrationId)
{
try {
ServiceRequest request = new ServiceRequest(configuration);
request.Parameters.Add("regid", registrationId);
XmlDocument response = request.CallService("rustici.registration.getLaunchHistory");
XmlElement launchHistory = ((XmlElement)response.GetElementsByTagName("launchhistory")[0]);
return LaunchInfo.ConvertToLaunchInfoList(launchHistory);
} catch (Exception ex) {
// error! just return an empty list?
return new List<LaunchInfo>();
}
}
Could you advise on how you'd propose users of this library handle errors in API calls with try/catch blocks?
For example - I'd rather not have to use the RegistrationExists() call before calling the GetLaunchHistory() to avoid making 2 API calls instead of one. So, if I call GetLaunchHistory and the registrationId I use is not found/invalid, I'd rather it fall into the try/catch and just keep moving on. Would you advise for or against this approach?
Here's a snippet of how I might try altering the GetLaunchHistory call - is this a bad idea or ok with you?
Related API calls:
The text was updated successfully, but these errors were encountered: