Skip to content

Commit

Permalink
Merge pull request #18 from jennifer-starratt/master
Browse files Browse the repository at this point in the history
Consider the status code when determining success/failure
  • Loading branch information
jey-starratt authored Feb 18, 2020
2 parents 94fa42b + f7ed21e commit a42d39c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.1.2] - 2020-02-17
### Fixed
- Decode errors within responses

## [0.1.1] - 2020-01-31
### Fixed
- Module/class name collision which caused Failed to load module 'MailchimpSDK' error when integrating.
Expand Down
4 changes: 2 additions & 2 deletions MailchimpSDK/MailchimpSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MARKETING_VERSION = 0.1.1;
MARKETING_VERSION = 0.1.2;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -488,7 +488,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MARKETING_VERSION = 0.1.1;
MARKETING_VERSION = 0.1.2;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
Expand Down
4 changes: 4 additions & 0 deletions MailchimpSDK/MailchimpSDK/Core/Networking/AnzeeAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ struct AnzeeAPI: API {
} else {
completionBlock(.failure(.requestError(err: err)))
}
} else if let jsonData = data, let errorResponse = try? JSONDecoder().decode(APIErrorResponse.self, from: jsonData) {
completionBlock(.failure(.apiError(response: errorResponse)))
} else if let httpResponse = response as? HTTPURLResponse, !(200..<300).contains(httpResponse.statusCode) {
completionBlock(.failure(.apiError(response: APIErrorResponse(status: 0, type: "Unexpected response", detail: ""))))
} else if let jsonData = data {
completionBlock(.success(jsonData))
} else {
Expand Down
2 changes: 1 addition & 1 deletion MailchimpSDK/MailchimpSDK/SDK/MailchimpSDK.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class MailchimpSDK: NSObject {
public static var debugMode: Bool = false

/// Version of this SDK.
public static let version: String = "0.1.1"
public static let version: String = "0.1.2"

/// The API protocol conforming object that processes requests for this class.
static var api: API?
Expand Down

0 comments on commit a42d39c

Please sign in to comment.