Skip to content

Commit

Permalink
Add messages to user-facing preconditions.
Browse files Browse the repository at this point in the history
  • Loading branch information
fumoboy007 committed Jan 8, 2024
1 parent 076ae7b commit 64405c3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ where ClockType: Clock, RandomNumberGeneratorType: RandomNumberGenerator {
self.clockMinResolution = clock.minimumResolution

self.baseDelayInClockTicks = baseDelay / clockMinResolution
precondition(baseDelayInClockTicks > 0)
precondition(baseDelayInClockTicks > 0, "The base delay must be greater than zero.")

if let maxDelay {
precondition(maxDelay >= baseDelay)
precondition(maxDelay >= baseDelay, "The max delay must be greater than or equal to the base delay.")
self.maxDelayInClockTicks = min(maxDelay / clockMinResolution,
Double(Self.implicitMaxDelayInClockTicks))
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ extension RetryableRequest {
with configuration: RetryConfiguration<ClockType>,
@_inheritActorContext @_implicitSelfCapture operation: (Self) async throws -> ReturnType
) async throws -> ReturnType {
precondition(isIdempotent)
precondition(isIdempotent, "The request is not idempotent: `\(self)`.")

return try await unsafeRetryIgnoringIdempotency(with: configuration,
operation: operation)
Expand Down

0 comments on commit 64405c3

Please sign in to comment.