I am using Apache Ignite 2.7.5 as Server and thin client in .Net core. When I'm doing operation related to cache put, get and load, etc .net core application automatically getting to crash.
So I want to handle exception inside for loop particular exception coming like for example IgniteCheckedException, BinaryInvalidTypeException, ClassNotFoundException, etc then throw from catch block and exit for loop otherwise continue for loop iteration if only Exception block.
public async void loadData(string configPath,List<JObject> dataList)
{
using (var ldr = _ignite.GetDataStreamer<string, Employee>(cacheName))
{
foreach (var item in parsedObjectList)
{
try
{
JObject keyObj = new JObject();
foreach (var keyName in keyArray)
{
keyObj[keyName.ToString()] = item[keyName.ToString()];
}
var serializerSettings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
JsonConvert.PopulateObject(item.ToString(), emp, serializerSettings);
string json = JsonConvert.SerializeObject(keyObj, Formatting.None);
string base64EncodedKey = Convert.ToBase64String(Encoding.UTF8.GetBytes(json));
await ldr.AddData(base64EncodedKey, emp);
}
catch (IgniteCheckedException ex)//how to handle here
{
throw;
}
catch (BinaryInvalidTypeException ex)//how to handle here
{
throw;
}
catch (ClassNotFoundException ex)//how to handle here
{
throw;
}
catch (Exception ex)
{
//continue for loop if data parsing ,some normal exception
Console.WriteLine(ex);
}
}
}
}
Anyone suggests me, how to achieve this one in .net core c# application.
IgniteCheckedExceptionhere? I think it is strictly internal API exception and strictly Java one. - alamar