Skip to content

Commit

Permalink
End early if page count is 0
Browse files Browse the repository at this point in the history
  • Loading branch information
jdmcd committed Jul 13, 2021
1 parent 0b8d542 commit 2d3361c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Sources/OneRoster/Client/OneRosterClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ public struct OneRosterClient {
self.logger.info("pageCountInt: \(pageCountInt)")
self.logger.info("pageCount: \(pageCount)")

guard pageCount > 0 else {
self.logger.info("Ending early - page count is \(pageCount)")
return self.client.eventLoop.future([])
}

if let error = try? jsonDecoder.decode(OneRosterError.self, from: data) {
let errorString = "OneRoster Error: \(error.errors.map { $0.description }.joined() )"
self.logger.error("\(errorString)")
Expand Down

0 comments on commit 2d3361c

Please sign in to comment.