File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
Sources/AsposeWordsCloud/Api Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -75,8 +75,13 @@ public class Configuration : Codable {
7575 }
7676
7777 // Returns URL to Aspose Cloud API with remote API version
78- public func getApiRootUrl( ) -> URL {
79- return URL ( string: self . getBaseUrl ( ) ) !. appendingPathComponent ( self . getApiVersion ( ) ) ;
78+ public func getApiRootUrl( ) throws -> URL {
79+ let url = URL ( string: self . getBaseUrl ( ) ) ;
80+ if ( url == nil ) {
81+ throw WordsApiError . badHostAddress ( hostName: self . getBaseUrl ( ) ) ;
82+ }
83+
84+ return url!. appendingPathComponent ( self . getApiVersion ( ) ) ;
8085 }
8186
8287 // Returns SDK name for using in statistics headers
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ public enum WordsApiError : LocalizedError {
3131 case requestError( errorCode: Int , message: String ? )
3232 case requiredArgumentError( argumentName: String )
3333 case invalidTypeSerialization( typeName: String )
34+ case badHostAddress( hostName: String )
3435
3536 public var errorDescription : String ? {
3637 switch self {
@@ -40,6 +41,8 @@ public enum WordsApiError : LocalizedError {
4041 return " Required argument \( argumentName) not present. " ;
4142 case let . invalidTypeSerialization( typeName) :
4243 return " Failed to serialize type ' \( typeName) '. " ;
44+ case let . badHostAddress( hostName) :
45+ return " Unable to resolve hostname address ' \( hostName) ' as url. " ;
4346 }
4447 }
4548}
You can’t perform that action at this time.
0 commit comments