From 991e9dbddbbfa62f52341f30296f39ee87cc63bf Mon Sep 17 00:00:00 2001 From: Honza Dvorsky Date: Sun, 4 Oct 2015 00:50:57 +0100 Subject: [PATCH] catching empty hosts now --- XcodeServerSDK.podspec | 2 +- XcodeServerSDK/XcodeServerConfig.swift | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/XcodeServerSDK.podspec b/XcodeServerSDK.podspec index 1437898..e62b6b9 100644 --- a/XcodeServerSDK.podspec +++ b/XcodeServerSDK.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "XcodeServerSDK" - s.version = "0.3.5" + s.version = "0.3.6" s.summary = "Access Xcode Server API with native Swift objects." s.homepage = "https://github.com/czechboy0/XcodeServerSDK" diff --git a/XcodeServerSDK/XcodeServerConfig.swift b/XcodeServerSDK/XcodeServerConfig.swift index 697da2e..4c2f4f0 100644 --- a/XcodeServerSDK/XcodeServerConfig.swift +++ b/XcodeServerSDK/XcodeServerConfig.swift @@ -67,11 +67,16 @@ public struct XcodeServerConfig : JSONSerializable { - returns: A fully initialized `XcodeServerConfig` instance. - throws: + - `NoHostProvided`: When the host string is empty. - `InvalidHostProvided`: When the host provided doesn't produce a valid `URL` - `InvalidSchemeProvided`: When the provided scheme is not `HTTPS` */ public init(var host: String, user: String? = nil, password: String? = nil, id: RefType? = nil) throws { + guard !host.isEmpty else { + throw ConfigurationErrors.NoHostProvided + } + guard let url = NSURL(string: host) else { throw ConfigurationErrors.InvalidHostProvided(host) }