@@ -858,8 +858,9 @@ struct ConnectionStateMachine {
858858 // substate machine.
859859 return . closeConnectionAndCleanup( cleanupContext)
860860 }
861-
862- switch queryStateMachine. errorHappened ( error) {
861+
862+ let action = queryStateMachine. errorHappened ( error)
863+ switch action {
863864 case . sendParseDescribeBindExecuteSync,
864865 . sendParseDescribeSync,
865866 . sendBindExecuteSync,
@@ -869,7 +870,7 @@ struct ConnectionStateMachine {
869870 . forwardStreamComplete,
870871 . wait,
871872 . read:
872- preconditionFailure ( " Invalid state: \( self . state) " )
873+ preconditionFailure ( " Invalid query state machine action in state : \( self . state) , action: \( action ) " )
873874
874875 case . evaluateErrorAtConnectionLevel:
875876 return . closeConnectionAndCleanup( cleanupContext)
@@ -894,12 +895,13 @@ struct ConnectionStateMachine {
894895 return . closeConnectionAndCleanup( cleanupContext)
895896 }
896897
897- switch closeStateMachine. errorHappened ( error) {
898+ let action = closeStateMachine. errorHappened ( error)
899+ switch action {
898900 case . sendCloseSync,
899901 . succeedClose,
900902 . read,
901903 . wait:
902- preconditionFailure ( " Invalid state: \( self . state) " )
904+ preconditionFailure ( " Invalid close state machine action in state : \( self . state) , action: \( action ) " )
903905 case . failClose( let closeCommandContext, with: let error) :
904906 return . failClose( closeCommandContext, with: error, cleanupContext: cleanupContext)
905907 }
@@ -1032,7 +1034,7 @@ extension ConnectionStateMachine {
10321034
10331035 return false
10341036 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 " )
10361038 case . serverClosedConnection:
10371039 return true
10381040 }
0 commit comments