Skip to content

Commit 6f6937b

Browse files
committed
Replace OperationException with ErrorException for response error handling in SNMP message extensions
1 parent 2d3eebc commit 6f6937b

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

SharpSnmpLib/Messaging/Net6SnmpMessageExtension.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,13 +279,13 @@ public static async Task<ISnmpMessage> GetResponseAsync(this ISnmpMessage reques
279279
var responseId = response.MessageId();
280280
if (responseId != requestId)
281281
{
282-
throw OperationException.Create(string.Format(CultureInfo.InvariantCulture, "wrong response sequence: expected {0}, received {1}", requestId, responseId), receiver.Address);
282+
throw ErrorException.Create(string.Format(CultureInfo.InvariantCulture, "wrong response sequence: expected {0}, received {1}", requestId, responseId), receiver.Address, response);
283283
}
284284

285285
return response;
286286
}
287287

288-
throw OperationException.Create(string.Format(CultureInfo.InvariantCulture, "wrong response type: {0}", responseCode), receiver.Address);
288+
throw ErrorException.Create(string.Format(CultureInfo.InvariantCulture, "wrong response type: {0}", responseCode), receiver.Address, response);
289289
}
290290

291291
#endregion

SharpSnmpLib/Messaging/SnmpMessageExtension.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,13 +371,13 @@ public static ISnmpMessage GetResponse(this ISnmpMessage request, int timeout, I
371371
var responseId = response.MessageId();
372372
if (responseId != requestId)
373373
{
374-
throw OperationException.Create(string.Format(CultureInfo.InvariantCulture, "wrong response sequence: expected {0}, received {1}", requestId, responseId), receiver.Address);
374+
throw ErrorException.Create(string.Format(CultureInfo.InvariantCulture, "wrong response sequence: expected {0}, received {1}", requestId, responseId), receiver.Address, response);
375375
}
376376

377377
return response;
378378
}
379379

380-
throw OperationException.Create(string.Format(CultureInfo.InvariantCulture, "wrong response type: {0}", responseCode), receiver.Address);
380+
throw ErrorException.Create(string.Format(CultureInfo.InvariantCulture, "wrong response type: {0}", responseCode), receiver.Address, response);
381381
}
382382

383383
#endregion
@@ -628,13 +628,13 @@ public static async Task<ISnmpMessage> GetResponseAsync(this ISnmpMessage reques
628628
var responseId = response.MessageId();
629629
if (responseId != requestId)
630630
{
631-
throw OperationException.Create(string.Format(CultureInfo.InvariantCulture, "wrong response sequence: expected {0}, received {1}", requestId, responseId), receiver.Address);
631+
throw ErrorException.Create(string.Format(CultureInfo.InvariantCulture, "wrong response sequence: expected {0}, received {1}", requestId, responseId), receiver.Address, response);
632632
}
633633

634634
return response;
635635
}
636636

637-
throw OperationException.Create(string.Format(CultureInfo.InvariantCulture, "wrong response type: {0}", responseCode), receiver.Address);
637+
throw ErrorException.Create(string.Format(CultureInfo.InvariantCulture, "wrong response type: {0}", responseCode), receiver.Address, response);
638638
}
639639

640640
#endregion

0 commit comments

Comments
 (0)