changes concerning exception handling

This commit is contained in:
Wolfgang Hottgenroth 2015-10-10 14:50:28 +02:00
parent ac2d5cccb9
commit 4df6273c95
2 changed files with 13 additions and 7 deletions

View File

@ -35,12 +35,18 @@ namespace Snmp2Mysql
}
}
SnmpGetterResultProvider res = snmpGetter.Exec();
foreach (SnmpGetterResult r in res)
{
Console.WriteLine("{0} {1} {2}: {3}", r.Index, r.Oid, r.Type, r.Value);
dc.add((int)r.Index, r.Value);
}
try
{
SnmpGetterResultProvider res = snmpGetter.Exec();
foreach (SnmpGetterResult r in res)
{
Console.WriteLine("{0} {1} {2}: {3}", r.Index, r.Oid, r.Type, r.Value);
dc.add((int)r.Index, r.Value);
}
}
catch (SnmpGetterException e) {
Console.WriteLine ("no result: {0}", e.Message);
}
}
}
}

View File

@ -140,7 +140,7 @@ namespace Snmp2Mysql
{
mPacket = (SnmpV2Packet)mTarget.Request(mPdu, mParams);
}
catch (SnmpNetworkException e)
catch (SnmpException e)
{
throw new SnmpGetterException(e.Message, e);
}