Skip to content

Commit 6dbef5b

Browse files
committed
Convert 'command timeout' exception to 'connect failed'.
1 parent 4bb63cc commit 6dbef5b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/MySqlConnector/MySql.Data.MySqlClient/MySqlConnection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ private async ValueTask<ServerSession> CreateSessionAsync(ConnectionPool? pool,
664664
var messageSuffix = (pool?.IsEmpty ?? false) ? " All pooled connections are in use." : "";
665665
throw new MySqlException(MySqlErrorCode.UnableToConnectToHost, "Connect Timeout expired." + messageSuffix, ex);
666666
}
667-
catch (MySqlException ex) when (timeoutSource?.IsCancellationRequested ?? false)
667+
catch (MySqlException ex) when ((timeoutSource?.IsCancellationRequested ?? false) || ((MySqlErrorCode) ex.Number == MySqlErrorCode.CommandTimeoutExpired))
668668
{
669669
throw new MySqlException(MySqlErrorCode.UnableToConnectToHost, "Connect Timeout expired.", ex);
670670
}

0 commit comments

Comments
 (0)