Skip to content

Commit

Permalink
Log first, then perhaps throw
Browse files Browse the repository at this point in the history
  • Loading branch information
FanDjango committed Nov 12, 2022
1 parent b18c37c commit e448296
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions FluentFTP/Client/AsyncClient/GetReply.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,17 @@ protected async Task<FtpReply> GetReplyAsyncInternal(CancellationToken token, st

var reply = new FtpReply();

if (!IsConnected) {
throw new InvalidOperationException("No connection to the server has been established.");
}

if (string.IsNullOrEmpty(command)) {
LogWithPrefix(FtpTraceLevel.Verbose, "Waiting for a response");
}
else {
LogWithPrefix(FtpTraceLevel.Verbose, "Waiting for response to: " + OnPostExecute(command));
}

if (!IsConnected) {
throw new InvalidOperationException("No connection to the server has been established.");
}

// Implement this: https://lists.apache.org/thread/xzpclw1015qncvczt8hg3nom2p5vtcf5
// Can not use the normal timeout mechanism though, as a System.TimeoutException
// causes the stream to disconnect.
Expand Down
8 changes: 4 additions & 4 deletions FluentFTP/Client/BaseClient/GetReply.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,17 @@ protected FtpReply GetReplyInternal(string command, bool exhaustNoop, int timeOu

lock (m_lock) {

if (!IsConnected) {
throw new InvalidOperationException("No connection to the server has been established.");
}

if (string.IsNullOrEmpty(command)) {
LogWithPrefix(FtpTraceLevel.Verbose, "Waiting for a response");
}
else {
LogWithPrefix(FtpTraceLevel.Verbose, "Waiting for response to: " + OnPostExecute(command));
}

if (!IsConnected) {
throw new InvalidOperationException("No connection to the server has been established.");
}

// Implement this: https://lists.apache.org/thread/xzpclw1015qncvczt8hg3nom2p5vtcf5
// Can not use the normal timeout mechanism though, as a System.TimeoutException
// causes the stream to disconnect.
Expand Down

0 comments on commit e448296

Please sign in to comment.