Skip to content

Commit

Permalink
Merge pull request #84 from BoltsFramework/nlutsenko.constants
Browse files Browse the repository at this point in the history
Make BFTaskErrorDomain, BFTaskMultipleExceptionsException public.
  • Loading branch information
nlutsenko committed Feb 27, 2015
2 parents 9408b01 + f39f06a commit 65e7c44
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
10 changes: 10 additions & 0 deletions Bolts/Common/BFTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@

#import <Foundation/Foundation.h>

/*!
Error domain used if there was multiple errors on <BFTask taskForCompletionOfAllTasks:>.
*/
extern NSString *const BFTaskErrorDomain;

/*!
An exception that is thrown if there was multiple exceptions on <BFTask taskForCompletionOfAllTasks:>.
*/
extern NSString *const BFTaskMultipleExceptionsException;

@class BFExecutor;
@class BFTask;

Expand Down
7 changes: 5 additions & 2 deletions Bolts/Common/BFTask.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
" Break on warnBlockingOperationOnMainThread() to debug.");
}

NSString *const BFTaskErrorDomain = @"bolts";
NSString *const BFTaskMultipleExceptionsException = @"BFMultipleExceptionsException";

@interface BFTask () {
id _result;
NSError *_error;
Expand Down Expand Up @@ -108,7 +111,7 @@ + (instancetype)taskForCompletionOfAllTasks:(NSArray *)tasks {
tcs.exception = [exceptions objectAtIndex:0];
} else {
NSException *exception =
[NSException exceptionWithName:@"BFMultipleExceptionsException"
[NSException exceptionWithName:BFTaskMultipleExceptionsException
reason:@"There were multiple exceptions."
userInfo:@{ @"exceptions": exceptions }];
tcs.exception = exception;
Expand All @@ -117,7 +120,7 @@ + (instancetype)taskForCompletionOfAllTasks:(NSArray *)tasks {
if (errors.count == 1) {
tcs.error = [errors objectAtIndex:0];
} else {
NSError *error = [NSError errorWithDomain:@"bolts"
NSError *error = [NSError errorWithDomain:BFTaskErrorDomain
code:kBFMultipleErrorsError
userInfo:@{ @"errors": errors }];
tcs.error = error;
Expand Down

0 comments on commit 65e7c44

Please sign in to comment.