Skip to content

Commit

Permalink
add validator for truncate size option
Browse files Browse the repository at this point in the history
  • Loading branch information
anitarua committed Nov 30, 2023
1 parent caaa8dc commit cdd69c6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Sources/momento/internal/utils/Validators.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ internal func validateTtl(ttl: TimeInterval?) throws {
}
}

internal func validateTruncateSize(size: Int?) throws {
if (size != nil && size! < 0) {
throw InvalidArgumentError(message: "size to truncate to must be a positive number")
}
}

internal func validateListSliceStartEnd(startIndex: Int?, endIndex: Int?) throws {
if startIndex == nil || endIndex == nil {
return
Expand Down

0 comments on commit cdd69c6

Please sign in to comment.