@@ -858,8 +858,9 @@ struct ConnectionStateMachine {
858
858
// substate machine.
859
859
return . closeConnectionAndCleanup( cleanupContext)
860
860
}
861
-
862
- switch queryStateMachine. errorHappened ( error) {
861
+
862
+ let action = queryStateMachine. errorHappened ( error)
863
+ switch action {
863
864
case . sendParseDescribeBindExecuteSync,
864
865
. sendParseDescribeSync,
865
866
. sendBindExecuteSync,
@@ -869,7 +870,7 @@ struct ConnectionStateMachine {
869
870
. forwardStreamComplete,
870
871
. wait,
871
872
. read:
872
- preconditionFailure ( " Invalid state: \( self . state) " )
873
+ preconditionFailure ( " Invalid query state machine action in state : \( self . state) , action: \( action ) " )
873
874
874
875
case . evaluateErrorAtConnectionLevel:
875
876
return . closeConnectionAndCleanup( cleanupContext)
@@ -894,12 +895,13 @@ struct ConnectionStateMachine {
894
895
return . closeConnectionAndCleanup( cleanupContext)
895
896
}
896
897
897
- switch closeStateMachine. errorHappened ( error) {
898
+ let action = closeStateMachine. errorHappened ( error)
899
+ switch action {
898
900
case . sendCloseSync,
899
901
. succeedClose,
900
902
. read,
901
903
. wait:
902
- preconditionFailure ( " Invalid state: \( self . state) " )
904
+ preconditionFailure ( " Invalid close state machine action in state : \( self . state) , action: \( action ) " )
903
905
case . failClose( let closeCommandContext, with: let error) :
904
906
return . failClose( closeCommandContext, with: error, cleanupContext: cleanupContext)
905
907
}
@@ -1032,7 +1034,7 @@ extension ConnectionStateMachine {
1032
1034
1033
1035
return false
1034
1036
case . clientClosesConnection, . clientClosedConnection:
1035
- preconditionFailure ( " Pure client error, that is thrown directly in PostgresConnection" )
1037
+ preconditionFailure ( " A pure client error was thrown directly in PostgresConnection, this shouldn't happen " )
1036
1038
case . serverClosedConnection:
1037
1039
return true
1038
1040
}
0 commit comments