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,6 +35,8 @@ namespace Snmp2Mysql
} }
} }
try
{
SnmpGetterResultProvider res = snmpGetter.Exec(); SnmpGetterResultProvider res = snmpGetter.Exec();
foreach (SnmpGetterResult r in res) foreach (SnmpGetterResult r in res)
{ {
@ -42,6 +44,10 @@ namespace Snmp2Mysql
dc.add((int)r.Index, 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); mPacket = (SnmpV2Packet)mTarget.Request(mPdu, mParams);
} }
catch (SnmpNetworkException e) catch (SnmpException e)
{ {
throw new SnmpGetterException(e.Message, e); throw new SnmpGetterException(e.Message, e);
} }