From 947be536069f94f6999ce7c1ab39b29829c1f304 Mon Sep 17 00:00:00 2001 From: Jeremy Chiang Date: Mon, 2 Mar 2020 11:37:53 -0800 Subject: [PATCH 1/4] Add missing error codes --- Netable/Netable/Error.swift | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Netable/Netable/Error.swift b/Netable/Netable/Error.swift index 3be135f..33dde1e 100644 --- a/Netable/Netable/Error.swift +++ b/Netable/Netable/Error.swift @@ -21,6 +21,29 @@ public enum NetableError: Error { } extension NetableError: LocalizedError { + public var errorCode: Int? { + switch self { + case .codingError: + return 0 + case .decodingError: + return 1 + case .httpError(let statusCode, _): + return statusCode + case .malformedURL: + return 3 + case .requestFailed: + return 4 + case .wrongServer: + return 5 + case .noData: + return 6 + case .resourceExtractionError: + return 7 + case .unknownError: + return 8 + } + } + public var errorDescription: String? { switch self { case .codingError(let message): From f71403b58bba9f8ee9a8b9ea1b377d4c7ae9dbda Mon Sep 17 00:00:00 2001 From: Jeremy Chiang Date: Mon, 2 Mar 2020 11:38:25 -0800 Subject: [PATCH 2/4] Bump version to 0.8.2 --- Netable.podspec | 4 ++-- Netable/Netable.xcodeproj/project.pbxproj | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Netable.podspec b/Netable.podspec index 4ffaf17..2905a68 100644 --- a/Netable.podspec +++ b/Netable.podspec @@ -1,12 +1,12 @@ Pod::Spec.new do |s| s.name = 'Netable' - s.version = '0.8.1' + s.version = '0.8.2' s.summary = 'A simple and swifty networking library.' s.description = 'Netable is a simple Swift framework for working with both simple and non-REST-compliant HTTP endpoints.' s.homepage = 'https://github.com/steamclock/netable/' s.license = { :type => 'MIT', :file => 'LICENSE' } s.author = { 'Brendan Lensink' => 'brendan@steamclock.com' } - s.source = { :git => 'https://github.com/steamclock/netable.git', :tag => 'v0.8.1' } + s.source = { :git => 'https://github.com/steamclock/netable.git', :tag => 'v0.8.2' } s.ios.deployment_target = '11.0' s.osx.deployment_target = '10.14' s.source_files = 'Netable/Netable/*.{swift,h,m}' diff --git a/Netable/Netable.xcodeproj/project.pbxproj b/Netable/Netable.xcodeproj/project.pbxproj index 9b754ad..6c15753 100644 --- a/Netable/Netable.xcodeproj/project.pbxproj +++ b/Netable/Netable.xcodeproj/project.pbxproj @@ -586,7 +586,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - MARKETING_VERSION = 0.8.1; + MARKETING_VERSION = 0.8.2; PRODUCT_BUNDLE_IDENTIFIER = com.steamclock.Netable; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; @@ -616,7 +616,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - MARKETING_VERSION = 0.8.1; + MARKETING_VERSION = 0.8.2; PRODUCT_BUNDLE_IDENTIFIER = com.steamclock.Netable; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; From 41862c37f170fcdc9a52163121be016632768c13 Mon Sep 17 00:00:00 2001 From: Jeremy Chiang Date: Mon, 2 Mar 2020 11:40:24 -0800 Subject: [PATCH 3/4] Update changelog for 0.8.2 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 338f51f..535bca2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [0.8.2] - 2020-03-02 +### Added +- Added missing error codes + ## [0.8.1] - 2020-02-11 ### Changed - Lowered minimum iOS target to 11 From cf43c15db5581258e111aaf0c014aa60d017611f Mon Sep 17 00:00:00 2001 From: Jeremy Chiang Date: Mon, 2 Mar 2020 13:40:03 -0800 Subject: [PATCH 4/4] Handle status code not related to http responses --- Netable/Netable/Error.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Netable/Netable/Error.swift b/Netable/Netable/Error.swift index 33dde1e..cdae1df 100644 --- a/Netable/Netable/Error.swift +++ b/Netable/Netable/Error.swift @@ -28,7 +28,7 @@ extension NetableError: LocalizedError { case .decodingError: return 1 case .httpError(let statusCode, _): - return statusCode + return statusCode < 100 ? 2 : statusCode case .malformedURL: return 3 case .requestFailed: