@@ -159,7 +159,7 @@ struct HTTP1ConnectionStateMachine {
159
159
metadata: RequestFramingMetadata
160
160
) -> Action {
161
161
guard case . idle = self . state else {
162
- preconditionFailure ( " Invalid state " )
162
+ preconditionFailure ( " Invalid state: \( self . state ) " )
163
163
}
164
164
165
165
var requestStateMachine = HTTPRequestStateMachine ( isChannelWritable: self . isChannelWritable)
@@ -173,7 +173,7 @@ struct HTTP1ConnectionStateMachine {
173
173
174
174
mutating func requestStreamPartReceived( _ part: IOData ) -> Action {
175
175
guard case . inRequest( var requestStateMachine, let close) = self . state else {
176
- preconditionFailure ( " Invalid state " )
176
+ preconditionFailure ( " Invalid state: \( self . state ) " )
177
177
}
178
178
179
179
return self . avoidingStateMachineCoW { state -> Action in
@@ -185,7 +185,7 @@ struct HTTP1ConnectionStateMachine {
185
185
186
186
mutating func requestStreamFinished( ) -> Action {
187
187
guard case . inRequest( var requestStateMachine, let close) = self . state else {
188
- preconditionFailure ( " Invalid state " )
188
+ preconditionFailure ( " Invalid state: \( self . state ) " )
189
189
}
190
190
191
191
return self . avoidingStateMachineCoW { state -> Action in
@@ -198,7 +198,7 @@ struct HTTP1ConnectionStateMachine {
198
198
mutating func requestCancelled( closeConnection: Bool ) -> Action {
199
199
switch self . state {
200
200
case . initialized:
201
- preconditionFailure ( " This event must only happen, if the connection is leased. During startup this is impossible " )
201
+ preconditionFailure ( " This event must only happen, if the connection is leased. During startup this is impossible. Invalid state: \( self . state ) " )
202
202
203
203
case . idle:
204
204
if closeConnection {
@@ -250,7 +250,7 @@ struct HTTP1ConnectionStateMachine {
250
250
mutating func channelRead( _ part: HTTPClientResponsePart ) -> Action {
251
251
switch self . state {
252
252
case . initialized, . idle:
253
- preconditionFailure ( " Invalid state " )
253
+ preconditionFailure ( " Invalid state: \( self . state ) " )
254
254
255
255
case . inRequest( var requestStateMachine, var close) :
256
256
return self . avoidingStateMachineCoW { state -> Action in
@@ -369,7 +369,7 @@ extension HTTP1ConnectionStateMachine.State {
369
369
return . forwardResponseBodyParts( parts)
370
370
case . succeedRequest( let finalAction, let finalParts) :
371
371
guard case . inRequest( _, close: let close) = self else {
372
- preconditionFailure ( " Invalid state " )
372
+ preconditionFailure ( " Invalid state: \( self ) " )
373
373
}
374
374
375
375
let newFinalAction : HTTP1ConnectionStateMachine . Action . FinalStreamAction
@@ -388,7 +388,7 @@ extension HTTP1ConnectionStateMachine.State {
388
388
case . failRequest( let error, let finalAction) :
389
389
switch self {
390
390
case . initialized:
391
- preconditionFailure ( " Invalid state " )
391
+ preconditionFailure ( " Invalid state: \( self ) " )
392
392
case . idle:
393
393
preconditionFailure ( " How can we fail a task, if we are idle " )
394
394
case . inRequest( _, close: let close) :
@@ -433,7 +433,7 @@ extension HTTP1ConnectionStateMachine: CustomStringConvertible {
433
433
case . closed:
434
434
return " .closed "
435
435
case . modifying:
436
- preconditionFailure ( " .modifying " )
436
+ preconditionFailure ( " Invalid state: \( self . state ) " )
437
437
}
438
438
}
439
439
}
0 commit comments