Skip to content

Commit

Permalink
Merge branch 'release/0.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Ochs committed Sep 12, 2014
2 parents f43eeac + 91fa457 commit b7ac8df
Show file tree
Hide file tree
Showing 8 changed files with 128 additions and 121 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# reference: http://www.objc.io/issue-6/travis-ci.html

language: objective-c
# before_install: cd Example && pod install && cd -
before_install: cd Example && pod install && cd -
script:
- xctool test -workspace Example/HRSCustomErrorHandling.xcworkspace -scheme HRSCustomErrorHandling -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#Changelog

## v0.1.1
- Minor fixes to support travis-ci as continuous integration server
- Reformat the documentation comments to support cocoadocs parsing

## v0.1.0
- Initial release
2 changes: 1 addition & 1 deletion HRSCustomErrorHandling.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "HRSCustomErrorHandling"
s.version = "0.1.0"
s.version = "0.1.1"
s.summary = "HRSCustomErrorHandling provides an easy way to handle error presentation and creation on iOS."
s.description = <<-DESC
HRSCustomErrorHandling is a small Framework that provides a base implementation for error handling in iOS applications. It deals with the problem to streamline the presentation of errors in various parts of an application as well as provide APIs to implement error specific recovery options the user of the application can choose from.
Expand Down
50 changes: 25 additions & 25 deletions Pod/Classes/HRSErrorPresenter.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,39 +17,39 @@
@interface HRSErrorPresenter : UIAlertView

/**
* @warning You should not set a custom delegate to a `HRSErrorPresenter`.
@warning You should not set a custom delegate to a `HRSErrorPresenter`.
*/
@property(nonatomic,assign) id delegate __unavailable;

/**
* Creates a new `HRSErrorPresenter` object (a `UIAlertView`) that is fully
* configured with the passed-in error and linked with the given completion
* handler.
*
* @note This does not automatically present the alert view. You still need to
call `show` on the returned object.
*
* @param error The error that should be presented.
* @param completionHandler The completion handler that should be called after
error recovery.
*
* @return The fully configured presenter object, ready to be shown to the user.
Creates a new `HRSErrorPresenter` object (a `UIAlertView`) that is fully
configured with the passed-in error and linked with the given completion
handler.
@note This does not automatically present the alert view. You still need to
call `show` on the returned object.
@param error The error that should be presented.
@param completionHandler The completion handler that should be called after
error recovery.
@return The fully configured presenter object, ready to be shown to the user.
*/
+ (instancetype)presenterWithError:(NSError *)error completionHandler:(void (^)(BOOL))completionHandler;

/**
* Initializes a `HRSErrorPresenter` object (a `UIAlertView`) that is fully
* configured with the passed-in error and linked with the given completion
* handler.
*
* @note This does not automatically present the alert view. You still need to
call `show` on the returned object.
*
* @param error The error that should be presented.
* @param completionHandler The completion handler that should be called after
error recovery.
*
* @return The fully configured presenter object, ready to be shown to the user.
Initializes a `HRSErrorPresenter` object (a `UIAlertView`) that is fully
configured with the passed-in error and linked with the given completion
handler.
@note This does not automatically present the alert view. You still need to
call `show` on the returned object.
@param error The error that should be presented.
@param completionHandler The completion handler that should be called after
error recovery.
@return The fully configured presenter object, ready to be shown to the user.
*/
- (instancetype)initWithError:(NSError *)error completionHandler:(void (^)(BOOL))completionHandler;

Expand Down
62 changes: 31 additions & 31 deletions Pod/Classes/HRSErrorRecoveryAttempter.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,49 +17,49 @@
@interface HRSErrorRecoveryAttempter : NSObject

/**
* Add a recovery option to the attempter that is used for presentation and
* error recovery.
*
* The recovery options are stored in the order they are added to the recovery
* attempter. The first option that is added should be the default option. The
* default option shout *not* be a destructive operation.
*
* @warning Make sure to add at least one recovery block that returns `NO`,
* such as a cancel recovery option, to make sure the user can break the error
* presentation cycle in the case your error recovery was not successful even
* though it should have been.
*
* @param title A localized title to be shown on a button to represent
the functionality of the recovery block.
* @param recoveryBlock The block that will be executed if the user selects
this recovery option.
Add a recovery option to the attempter that is used for presentation and error
recovery.
The recovery options are stored in the order they are added to the recovery
attempter. The first option that is added should be the default option. The
default option shout *not* be a destructive operation.
@warning Make sure to add at least one recovery block that returns `NO`,
such as a cancel recovery option, to make sure the user can break the
error presentation cycle in the case your error recovery was not
successful even though it should have been.
@param title A localized title to be shown on a button to represent
the functionality of the recovery block.
@param recoveryBlock The block that will be executed if the user selects
this recovery option.
*/
- (void)addRecoveryOptionWithTitle:(NSString *)title recoveryAttempt:(BOOL(^)())recoveryBlock;

/**
* A convenience method to adds a recovery option that does no recovery and is
* represented on a button as 'OK'.
*
* The text is localized in all languages supported by UIKit.
A convenience method to adds a recovery option that does no recovery and is
represented on a button as 'OK'.
The text is localized in all languages supported by UIKit.
*/
- (void)addOkayRecoveryOption;

/**
* A convenience method to adds a recovery option that does no recovery and is
* represented on a button as 'Cancel'.
*
* The text is localized in all languages supported by UIKit.
A convenience method to adds a recovery option that does no recovery and is
represented on a button as 'Cancel'.
The text is localized in all languages supported by UIKit.
*/
- (void)addCancelRecoveryOption;

/**
* The localized recovery option titles that have been added to the attempter.
*
* This method is ment to provide a convenience way to add the localized
* recovery options to a `NSError` as the `NSLocalizedRecoveryOptionsErrorKey`.
*
* @return The array with all localized recovery option titles. The first title
is the default recovery option.
The localized recovery option titles that have been added to the attempter.
This method is ment to provide a convenience way to add the localized
recovery options to a `NSError` as the `NSLocalizedRecoveryOptionsErrorKey`.
@return The array with all localized recovery option titles. The first title
is the default recovery option.
*/
- (NSArray *)localizedRecoveryOptions;

Expand Down
24 changes: 12 additions & 12 deletions Pod/Classes/Private/HRSErrorPresenterDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@
@interface HRSErrorPresenterDelegate : NSObject <UIAlertViewDelegate>

/**
* Creates a presenter delegate to work closely together with the
* `HRSErrorPresenter`.
*
* @note You should not create such an object on your own, instead, this object
is presented for you when creating an `HRSErrorPresenter`.
*
* @param error The error the corresponding `HRSErrorPresenter`
will show.
* @param completionHandler The completion handler that should be invoked after
error recovery completed.
*
* @return The delegate to be used by the `HRSErrorPresenter` instance.
Creates a presenter delegate to work closely together with the
`HRSErrorPresenter`.
@note You should not create such an object on your own, instead, this object
is presented for you when creating an `HRSErrorPresenter`.
@param error The error the corresponding `HRSErrorPresenter` will
show.
@param completionHandler The completion handler that should be invoked after
error recovery completed.
@return The delegate to be used by the `HRSErrorPresenter` instance.
*/
+ (instancetype)delegateWithError:(NSError *)error completionHandler:(void(^)(BOOL))completionHandler;

Expand Down
99 changes: 49 additions & 50 deletions Pod/Classes/UIResponder+HRSCustomErrorPresentation.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,60 +17,59 @@
@interface UIResponder (HRSCustomErrorPresentation)

/**
* Presents an error to the user.
*
* The default implementation of this method will call `willPresentError:` with
* the error that was passed to this method. The resulting error will then be
* forwarded up the responder chain. If there is no next responder, the error
* is forwarded to the current `UIApplication` instance.
*
* If the responder that receives this message is the application delegate or
* it is the application itself and the application delegate does not inherit
* from `UIResponder` the error is presented in a `UIAlertView` dialog.
*
* After the user dismisses the alert view, the error recovery for this option
* is automatically started. After the error recovery, the completion handler
* is called, reporting whether the recovery was successful or not.
*
* It is recommended to retry the action that lead to the error in the first
* place when the error recovery was successful.
*
* @note You can override this method in your application delegate to create
your own custom error presentation UI. Make sure to let your delegate
inherit from `UIResponder` for this hook to work.
*
* @param error The error that should be presented to the user.
* @param completionHandler The completion handler that is called when the user
taps a button and the error recovery was completed.
didRecover Is true if the error recovery was
successful. You should retry the action
that lead to the error in this case.
Presents an error to the user.
The default implementation of this method will call `willPresentError:` with
the error that was passed to this method. The resulting error will then be
forwarded up the responder chain. If there is no next responder, the error
is forwarded to the current `UIApplication` instance.
If the responder that receives this message is the application delegate or it
is the application itself and the application delegate does not inherit from
`UIResponder` the error is presented in a `UIAlertView` dialog.
After the user dismisses the alert view, the error recovery for this option is
automatically started. After the error recovery, the completion handler is
called, reporting whether the recovery was successful or not.
It is recommended to retry the action that lead to the error in the first place
when the error recovery was successful.
@note You can override this method in your application delegate to create your
own custom error presentation UI. Make sure to let your delegate inherit
from `UIResponder` for this hook to work.
@param error The error that should be presented to the user.
@param completionHandler The completion handler that is called when the user
taps a button and the error recovery was completed.
didRecover Is true if the error recovery was
successful. You should retry the action that lead to
the error in this case.
*/
- (void)presentError:(NSError *)error completionHandler:(void (^)(BOOL didRecover))completionHandler;

/**
* Called when the receiver is about to present or forward an error. The
* returned error is the error that is should actually be presented or
* forwarded.
*
* The default implementation of this method immediately returns the passed-in
* error.
*
* You can manipulate the passed-in error to change the presentation of the
* error in three ways:
* (1) return the error that was passed to the method to not change the error.
* (2) return nil to stop the error from being presented.
* (3) return a new error that will be presented instead.
It is recommended to only touch the parameters of the error you really
want to change and leave the rest as it is. E.g. when you want to change
the localized text that is shown to the user, leave the error domain,
the error code and all other keys from the `userInfo` dictionary as they
are to give other responders in the chain a chance to identify the error.
*
* @param error The error the receiver wants to present or forward.
*
* @return The error you want the receiver to present or forward or nil if you
do not want any error to be presented or forwarded.
Called when the receiver is about to present or forward an error. The returned
error is the error that is should actually be presented or forwarded.
The default implementation of this method immediately returns the passed-in
error.
You can manipulate the passed-in error to change the presentation of the error
in three ways:
(1) return the error that was passed to the method to not change the error.
(2) return nil to stop the error from being presented.
(3) return a new error that will be presented instead.
It is recommended to only touch the parameters of the error you really
want to change and leave the rest as it is. E.g. when you want to change
the localized text that is shown to the user, leave the error domain, the
error code and all other keys from the `userInfo` dictionary as they are to
give other responders in the chain a chance to identify the error.
@param error The error the receiver wants to present or forward.
@return The error you want the receiver to present or forward or nil if you
do not want any error to be presented or forwarded.
*/
- (NSError *)willPresentError:(NSError *)error;

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.0
0.1.1

0 comments on commit b7ac8df

Please sign in to comment.