Skip to content

Commit edb1ec6

Browse files
authored
Improve error message when client is run when shutdown (#2215)
Motivation: GRPCClient can throw an error when run is called more than once or if run is called after it has been shutdown. Normally this would happen if a user caller 'run()' more than once, but can also happen if 'withGRPCClient' is called and the client is never used and the body returns quickly. Modifications: - Improve the error message Result: Better error message.
1 parent c4d6281 commit edb1ec6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Sources/GRPCCore/GRPCClient.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,11 @@ public final class GRPCClient<Transport: ClientTransport>: Sendable {
8989
case .stopping, .stopped:
9090
throw RuntimeError(
9191
code: .clientIsStopped,
92-
message: "The client has stopped and can only be started once."
92+
message: """
93+
Can't call 'runConnections()' as the client is stopped (or is stopping). \
94+
This can happen if the you call 'runConnections()' after shutting the \
95+
client down or if you used 'withGRPCClient' with an empty body.
96+
"""
9397
)
9498
}
9599
}

0 commit comments

Comments
 (0)