Refactoring error creation

This commit is contained in:
Jonathan Carter
2016-03-13 21:20:40 -07:00
parent 27408709f0
commit ba24d9abc0
4 changed files with 378 additions and 365 deletions

View File

@@ -0,0 +1,20 @@
#import "CodePush.h"
@implementation CodePushErrorUtils
static NSString *const CodePushErrorDomain = @"CodePushError";
static const int CodePushErrorCode = -1;
+ (NSError *)errorWithMessage:(NSString *)errorMessage
{
return [NSError errorWithDomain:CodePushErrorDomain
code:CodePushErrorCode
userInfo:@{ NSLocalizedDescriptionKey: NSLocalizedString(errorMessage, nil) }];
}
+ (BOOL)isCodePushError:(NSError *)err
{
return err != nil && [CodePushErrorDomain isEqualToString:err.domain];
}
@end