Skip to content

Commit

Permalink
From now on when the SDK encounters a newer API version, instead of e…
Browse files Browse the repository at this point in the history
…rroring out, it will just log that fact, but will still attempt to function as best as it can.
  • Loading branch information
czechboy0 committed Jan 14, 2016
1 parent e16a548 commit 32cfe81
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions XcodeServerSDK/XcodeServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ extension XcodeServer : NSURLSessionDelegate {

// MARK: Header constants
let Headers_APIVersion = "X-XCSAPIVersion"
let SupportedAPIVersions: Set<Int> = [6, 7] //will change with time, this codebase supports this version
let VerifiedAPIVersions: Set<Int> = [6, 7] //will change with time, this codebase supports these versions

// MARK: XcodeServer API methods
public extension XcodeServer {
Expand All @@ -88,17 +88,16 @@ public extension XcodeServer {
let apiVersion = Int(apiVersionString)

if let apiVersion = apiVersion where
apiVersion > 0 && !SupportedAPIVersions.contains(apiVersion) {
var common = "Version mismatch: response from API version \(apiVersion), but we support version \(SupportedAPIVersions). "
apiVersion > 0 && !VerifiedAPIVersions.contains(apiVersion) {
var common = "Version mismatch: response from API version \(apiVersion), but we only verified versions \(VerifiedAPIVersions). "

let maxVersion = SupportedAPIVersions.sort().last!
let maxVersion = VerifiedAPIVersions.sort().last!
if apiVersion > maxVersion {
common += "You're using a newer Xcode Server than we support. Please visit https:/czechboy0/XcodeServerSDK to check whether there's a new version of the SDK for it."
Log.info("You're using a newer Xcode Server than we've verified (\(apiVersion), last verified is \(maxVersion)). Please visit https:/czechboy0/XcodeServerSDK to check whether there's a new version of the SDK for it. If not, please file an issue in the XcodeServerSDK repository. The requests are still going through, however we haven't verified this API version, so here be dragons.")
} else {
common += "You're using an old Xcode Server which we don't support any more. Please look for an older version of the SDK at https:/czechboy0/XcodeServerSDK or consider upgrading your Xcode Server to the current version."
return Error.withInfo(common)
}

return Error.withInfo(common)
}

//all good
Expand Down

0 comments on commit 32cfe81

Please sign in to comment.