Skip to content

Commit

Permalink
Merge branch 'deploy/0.2.0' into productive
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeehut committed Oct 24, 2018
2 parents cc46726 + ec20d7b commit 0a0732f
Show file tree
Hide file tree
Showing 14 changed files with 158 additions and 23 deletions.
14 changes: 3 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +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).

## [Unreleased]

## [0.2.0] - 2018-10-24
### Added
- Some new features such as a new rule.
### Changed
- Some change in functionality on existing rules.
### Deprecated
- Some feature that will be removed in a future version.
### Removed
- Some feature that was removed.
### Fixed
- Some bug that was fixed. Should link to issue. [#0](https://github.com/Flinesoft/{TOOL_NAME}/issues/0)
### Security
- Some security related fix.
- Convenience implementations of error protocols: `MungoError`, `MungoFatalError` & `MungoHealableError`

## [0.1.0] - 2018-10-16
### Added
Expand Down
16 changes: 16 additions & 0 deletions Frameworks/MungoHealer/ErrorTypes/MungoError.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// Created by Cihat Gündüz on 16.10.18.
// Copyright © 2018 Jamit Labs GmbH. All rights reserved.
//

import Foundation

public class MungoError: BaseError {
public let source: ErrorSource
public let errorDescription: String

public init(source: ErrorSource, message: String) {
self.source = source
self.errorDescription = message
}
}
8 changes: 8 additions & 0 deletions Frameworks/MungoHealer/ErrorTypes/MungoFatalError.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//
// Created by Cihat Gündüz on 16.10.18.
// Copyright © 2018 Jamit Labs GmbH. All rights reserved.
//

import Foundation

public class MungoFatalError: MungoError, FatalError { /* only semantically different than MungoError */ }
16 changes: 16 additions & 0 deletions Frameworks/MungoHealer/ErrorTypes/MungoHealableError.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// Created by Cihat Gündüz on 16.10.18.
// Copyright © 2018 Jamit Labs GmbH. All rights reserved.
//

import Foundation

public class MungoHealableError: MungoError, HealableError {
public let healingOptions: [HealingOption]

public init(source: ErrorSource, message: String, healingOption: HealingOption) {
let cancelOption = HealingOption(style: .normal, title: LocalizedString("ERROR_TYPES.CANCEL_BUTTON.TITLE")) {}
self.healingOptions = [cancelOption, healingOption]
super.init(source: source, message: message)
}
}
2 changes: 1 addition & 1 deletion Frameworks/SupportingFiles/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.1.0</string>
<string>0.2.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
Expand Down
5 changes: 4 additions & 1 deletion Frameworks/SupportingFiles/de.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
"ALERT_LOG_ERROR_HANDLER.GENERIC_ERROR_TITLE" = "Unbekannter Fehler";

// Alert Log Error Handler - Error Source Title
"ALERT_LOG_ERROR_HANDLER.ERROR_SOURCE_TITLE.INVALID_USER_INPUT" = "Ungültige Dateneingabe";
"ALERT_LOG_ERROR_HANDLER.ERROR_SOURCE_TITLE.INVALID_USER_INPUT" = "Ungültige Nutzereingabe";
"ALERT_LOG_ERROR_HANDLER.ERROR_SOURCE_TITLE.INTERNAL_INCONSISTENCY" = "Interner Fehler";
"ALERT_LOG_ERROR_HANDLER.ERROR_SOURCE_TITLE.EXTERNAL_SYSTEM_UNAVAILABLE" = "Externes System nicht verfügbar";
"ALERT_LOG_ERROR_HANDLER.ERROR_SOURCE_TITLE.EXTERNAL_SYSTEM_BEHAVED_UNEXPECTEDLY" = "Unerwartetes Verhalten";

// Alert Log Error Handler - Buttons
"ALERT_LOG_ERROR_HANDLER.OKAY_BUTTON.TITLE" = "Okay";
"ALERT_LOG_ERROR_HANDLER.TERMINATE_BUTTON.TITLE" = "App beenden";

// ErrorTypes
"ERROR_TYPES.CANCEL_BUTTON.TITLE" = "Abbrechen";
3 changes: 3 additions & 0 deletions Frameworks/SupportingFiles/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@
// Alert Log Error Handler - Buttons
"ALERT_LOG_ERROR_HANDLER.OKAY_BUTTON.TITLE" = "Okay";
"ALERT_LOG_ERROR_HANDLER.TERMINATE_BUTTON.TITLE" = "Terminate App";

// ErrorTypes
"ERROR_TYPES.CANCEL_BUTTON.TITLE" = "Cancel";
9 changes: 4 additions & 5 deletions MungoHealer.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "MungoHealer"
s.version = "0.1.0"
s.version = "0.2.0"
s.summary = "Error Handler based on localized & healable (recoverable) errors without the overhead of NSError. "

s.description = <<-DESC
Expand All @@ -20,9 +20,8 @@ Pod::Spec.new do |s|

s.source = { :git => "https://github.com/JamitLabs/MungoHealer.git", :tag => "#{s.version}" }
s.source_files = "Frameworks/MungoHealer", "Frameworks/MungoHealer/**/*.swift"
s.framework = "Foundation"

# s.dependency "HandyUIKit", "~> 1.6"
# s.dependency "HandySwift", "~> 2.5"
s.framework = "UIKit"
s.swift_version = "4.2"
s.resource_bundle = { "MungoHealer" => ["Frameworks/SupportingFiles/*.lproj"] }

end
32 changes: 29 additions & 3 deletions MungoHealer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@
825D65222174DA77007A3ED3 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 825D65242174DA77007A3ED3 /* Localizable.strings */; };
825D65282174DB4C007A3ED3 /* Globals.swift in Sources */ = {isa = PBXBuildFile; fileRef = 825D65272174DB4C007A3ED3 /* Globals.swift */; };
825D65292174DB4C007A3ED3 /* Globals.swift in Sources */ = {isa = PBXBuildFile; fileRef = 825D65272174DB4C007A3ED3 /* Globals.swift */; };
82C646E321762A9B00A41245 /* MungoError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82C646E221762A9B00A41245 /* MungoError.swift */; };
82C646E421762A9B00A41245 /* MungoError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82C646E221762A9B00A41245 /* MungoError.swift */; };
82C646E621762B7500A41245 /* MungoFatalError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82C646E521762B7500A41245 /* MungoFatalError.swift */; };
82C646E721762B7500A41245 /* MungoFatalError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82C646E521762B7500A41245 /* MungoFatalError.swift */; };
82C646E921762B7F00A41245 /* MungoHealableError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82C646E821762B7F00A41245 /* MungoHealableError.swift */; };
82C646EA21762B7F00A41245 /* MungoHealableError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82C646E821762B7F00A41245 /* MungoHealableError.swift */; };
A102BD481F02355A000C6B38 /* MungoHealer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A102BD3E1F02355A000C6B38 /* MungoHealer.framework */; };
A102BD821F023582000C6B38 /* MungoHealer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A102BD791F023582000C6B38 /* MungoHealer.framework */; };
A102BDB31F0238E8000C6B38 /* ExampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A102BDB01F0238BD000C6B38 /* ExampleTests.swift */; };
Expand Down Expand Up @@ -102,6 +108,9 @@
825D65232174DA77007A3ED3 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
825D65252174DA8E007A3ED3 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = "<group>"; };
825D65272174DB4C007A3ED3 /* Globals.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Globals.swift; sourceTree = "<group>"; };
82C646E221762A9B00A41245 /* MungoError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MungoError.swift; sourceTree = "<group>"; };
82C646E521762B7500A41245 /* MungoFatalError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MungoFatalError.swift; sourceTree = "<group>"; };
82C646E821762B7F00A41245 /* MungoHealableError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MungoHealableError.swift; sourceTree = "<group>"; };
A102BD3E1F02355A000C6B38 /* MungoHealer.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MungoHealer.framework; sourceTree = BUILT_PRODUCTS_DIR; };
A102BD471F02355A000C6B38 /* MungoHealer-iOS-Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "MungoHealer-iOS-Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
A102BD791F023582000C6B38 /* MungoHealer.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MungoHealer.framework; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -159,14 +168,14 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
825D65112174D1FD007A3ED3 /* Errors */ = {
825D65112174D1FD007A3ED3 /* ErrorsProtocols */ = {
isa = PBXGroup;
children = (
825D64DB2174B888007A3ED3 /* BaseError.swift */,
825D64E02174BB1C007A3ED3 /* FatalError.swift */,
825D650B2174C5E5007A3ED3 /* HealableError.swift */,
);
path = Errors;
path = ErrorsProtocols;
sourceTree = "<group>";
};
825D65122174D2C6007A3ED3 /* Models */ = {
Expand Down Expand Up @@ -204,6 +213,16 @@
path = Globals;
sourceTree = "<group>";
};
82C646E121762A4C00A41245 /* ErrorTypes */ = {
isa = PBXGroup;
children = (
82C646E221762A9B00A41245 /* MungoError.swift */,
82C646E521762B7500A41245 /* MungoFatalError.swift */,
82C646E821762B7F00A41245 /* MungoHealableError.swift */,
);
path = ErrorTypes;
sourceTree = "<group>";
};
A102BD341F02355A000C6B38 = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -240,7 +259,8 @@
children = (
825D64CB2174AFCB007A3ED3 /* MungoHealer.swift */,
825D65132174D2D6007A3ED3 /* ErrorHandlers */,
825D65112174D1FD007A3ED3 /* Errors */,
82C646E121762A4C00A41245 /* ErrorTypes */,
825D65112174D1FD007A3ED3 /* ErrorsProtocols */,
825D65262174DB36007A3ED3 /* Globals */,
825D65122174D2C6007A3ED3 /* Models */,
);
Expand Down Expand Up @@ -641,10 +661,13 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
82C646E621762B7500A41245 /* MungoFatalError.swift in Sources */,
82C646E321762A9B00A41245 /* MungoError.swift in Sources */,
825D64E12174BB1C007A3ED3 /* FatalError.swift in Sources */,
825D64CC2174AFCB007A3ED3 /* MungoHealer.swift in Sources */,
825D650F2174C67D007A3ED3 /* HealingOption.swift in Sources */,
825D651C2174D570007A3ED3 /* UIWindowExtension.swift in Sources */,
82C646E921762B7F00A41245 /* MungoHealableError.swift in Sources */,
825D65182174D335007A3ED3 /* ErrorHandler.swift in Sources */,
825D65152174D32A007A3ED3 /* AlertLogErrorHandler.swift in Sources */,
825D650C2174C5E5007A3ED3 /* HealableError.swift in Sources */,
Expand All @@ -666,10 +689,13 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
82C646E721762B7500A41245 /* MungoFatalError.swift in Sources */,
82C646E421762A9B00A41245 /* MungoError.swift in Sources */,
825D64E32174BB1C007A3ED3 /* FatalError.swift in Sources */,
825D64CE2174AFCB007A3ED3 /* MungoHealer.swift in Sources */,
825D65102174C67D007A3ED3 /* HealingOption.swift in Sources */,
825D651D2174D570007A3ED3 /* UIWindowExtension.swift in Sources */,
82C646EA21762B7F00A41245 /* MungoHealableError.swift in Sources */,
825D65192174D335007A3ED3 /* ErrorHandler.swift in Sources */,
825D65162174D32A007A3ED3 /* AlertLogErrorHandler.swift in Sources */,
825D650D2174C5E5007A3ED3 /* HealableError.swift in Sources */,
Expand Down
4 changes: 4 additions & 0 deletions MungoHealer.xcodeproj/xcshareddata/IDETemplateMacros.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@
<plist version="1.0">
<dict>
<key>FILEHEADER</key>
<string>
// Created by ___FULLUSERNAME___ on ___DATE___.
// ___COPYRIGHT___
//</string>
</dict>
</plist>
72 changes: 70 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
alt="Build Status">
</a>
<a href="https://github.com/JamitLabs/MungoHealer/releases">
<img src="https://img.shields.io/badge/Version-0.1.0-blue.svg"
alt="Version: 0.1.0">
<img src="https://img.shields.io/badge/Version-0.2.0-blue.svg"
alt="Version: 0.2.0">
</a>
<img src="https://img.shields.io/badge/Swift-4.2-FFAC45.svg"
alt="Swift: 4.2">
Expand Down Expand Up @@ -43,6 +43,7 @@ While there are many ways to deal with such situations, MungoHealer provides a s
## Installation

Installing via [Carthage](https://github.com/Carthage/Carthage#carthage) & [CocoaPods](https://guides.cocoapods.org/using/getting-started.html) are both supported.

Support for SPM is currently not possible as this framework uses UIKit.

## Usage
Expand All @@ -53,6 +54,7 @@ Please also have a look at the `MungoHealer iOS-Demo` project in the subfolder `
### Features Overview

- [Defining Errors](#defining-errors)
- [Default Error Types](#default-error-types)
- [Error Handling](#error-handling)
- [Usage Example](#usage-example)

Expand Down Expand Up @@ -176,6 +178,72 @@ struct NetworkUnavailableError: HealableError {

</details>

### Default Error Types

MungoHealer provides one basic implementation of each error protocol which you can use for convenience so you don't have to write a new error type for simple message errors. These are:

<details>
<summary>MungoError</summary>

- Implements `BaseError`
- `init` takes `source: ErrorSource` & `message: String`

Example Usage:

```swift
func fetchImage(urlPath: String) {
guard let url = URL(string: urlPath) else {
throw MungoError(source: .invalidUserInput, message: "Invalid Path")
}

// ...
}
```

</details>

<details>
<summary>MungoFatalError</summary>

- Implements `FatalError`
- `init` takes `source: ErrorSource` & `message: String`

Example Usage:

```swift
func fetchImage(urlPath: String) {
guard let url = URL(string: urlPath) else {
throw MungoFatalError(source: .invalidUserInput, message: "Invalid Path")
}

// ...
}
```

</details>

<details>
<summary>MungoHealableError</summary>

- Implements `HealableError`
- `init` takes `source: ErrorSource` & `message: String`
- `init` additionally takes `healOption: HealOption`

Example Usage:

```swift
func fetchImage(urlPath: String) {
guard let url = URL(string: urlPath) else {
let healingOption = HealingOption(style: .recommended, title: "Retry") { [weak self] in self?.fetchImage(urlPath: urlPath) }
throw MungoHealableError(source: .invalidUserInput, message: "Invalid Path", healingOption: healingOption)
}

// ...
}
```

</details>

### Error Handling

MungoHealer makes handling errors easier by providing the `ErrorHandler` protocol and a default implementation of it based on alert views, namely `AlertLogErrorHandler`.
Expand Down

0 comments on commit 0a0732f

Please sign in to comment.