Skip to content

Commit

Permalink
Do not throw InvalidOperationException (#234)
Browse files Browse the repository at this point in the history
  • Loading branch information
fw2568 committed Jun 16, 2023
1 parent 61c8bda commit 05717ec
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/YaNco.Core/Connection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,13 @@ public Connection(
catch (Exception ex)
{
rfcRuntime.Logger.IfSome(l => l.LogException(ex));
return (null, Prelude.Left(RfcErrorInfo.Error(ex.Message)));
}

throw new InvalidOperationException();
rfcRuntime.Logger.IfSome(l => l.LogError(
$"Invalid rfc connection message {msg.GetType()}"));
return (null, Prelude.Left(RfcErrorInfo.Error($"Invalid rfc connection message {msg.GetType().Name}")));

});
}

Expand Down
7 changes: 5 additions & 2 deletions src/YaNco.Core/RfcServer.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using Dbosoft.Functional;
using LanguageExt;
Expand Down Expand Up @@ -75,9 +74,13 @@ private RfcServer(IRfcServerHandle serverHandle, IRfcRuntime rfcRuntime)
catch (Exception ex)
{
rfcRuntime.Logger.IfSome(l => l.LogException(ex));
return (null, Prelude.Left(RfcErrorInfo.Error(ex.Message)));
}

throw new InvalidOperationException();
rfcRuntime.Logger.IfSome(l => l.LogError(
$"Invalid rfc server message {msg.GetType()}"));
return (null, Prelude.Left(RfcErrorInfo.Error($"Invalid rfc server message {msg.GetType().Name}")));

});

}
Expand Down

0 comments on commit 05717ec

Please sign in to comment.