Skip to content

Commit

Permalink
Continued refactoring error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
cnstoll committed Jun 25, 2014
1 parent 6463c7d commit 7a3f23b
Show file tree
Hide file tree
Showing 10 changed files with 275 additions and 302 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

/* Begin PBXBuildFile section */
262496B816D9E45000767D83 /* MMRecordCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 262496B716D9E45000767D83 /* MMRecordCache.m */; };
2648FBEA195B0861009A6CBB /* MMRecordDebugger.m in Sources */ = {isa = PBXBuildFile; fileRef = 2648FBE8195AFC5B009A6CBB /* MMRecordDebugger.m */; };
267469E516A1C128006A6A81 /* MMRecordResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 267469E416A1C128006A6A81 /* MMRecordResponse.m */; };
267469EC16A1C226006A6A81 /* MMRecordProtoRecord.m in Sources */ = {isa = PBXBuildFile; fileRef = 267469EB16A1C226006A6A81 /* MMRecordProtoRecord.m */; };
2690DDEE16DAE38A00FE31AC /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2690DDED16DAE38A00FE31AC /* MobileCoreServices.framework */; };
Expand Down Expand Up @@ -82,6 +83,8 @@
/* Begin PBXFileReference section */
262496B616D9E45000767D83 /* MMRecordCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMRecordCache.h; sourceTree = "<group>"; };
262496B716D9E45000767D83 /* MMRecordCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMRecordCache.m; sourceTree = "<group>"; };
2648FBE7195AFC5B009A6CBB /* MMRecordDebugger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMRecordDebugger.h; sourceTree = "<group>"; };
2648FBE8195AFC5B009A6CBB /* MMRecordDebugger.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMRecordDebugger.m; sourceTree = "<group>"; };
267469E316A1C128006A6A81 /* MMRecordResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMRecordResponse.h; sourceTree = "<group>"; };
267469E416A1C128006A6A81 /* MMRecordResponse.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMRecordResponse.m; sourceTree = "<group>"; };
267469EA16A1C226006A6A81 /* MMRecordProtoRecord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMRecordProtoRecord.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -151,7 +154,6 @@
55F951FB165C73460060851E /* ADNPostsViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ADNPostsViewController.m; sourceTree = "<group>"; };
55F9520B165C741E0060851E /* MMRecord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMRecord.h; sourceTree = "<group>"; };
55F9520C165C741E0060851E /* MMRecord.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMRecord.m; sourceTree = "<group>"; };
55F9520E165C741E0060851E /* MMRecordErrors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMRecordErrors.h; sourceTree = "<group>"; };
55F9520F165C741E0060851E /* MMServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMServer.h; sourceTree = "<group>"; };
55F95210165C741E0060851E /* MMServer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MMServer.m; sourceTree = "<group>"; };
55F95211165C741E0060851E /* MMServerPageManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MMServerPageManager.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -390,7 +392,8 @@
55F9520C165C741E0060851E /* MMRecord.m */,
262496B616D9E45000767D83 /* MMRecordCache.h */,
262496B716D9E45000767D83 /* MMRecordCache.m */,
55F9520E165C741E0060851E /* MMRecordErrors.h */,
2648FBE7195AFC5B009A6CBB /* MMRecordDebugger.h */,
2648FBE8195AFC5B009A6CBB /* MMRecordDebugger.m */,
5569077916FA750D0040D191 /* MMRecordMarshaler.h */,
5569077A16FA750D0040D191 /* MMRecordMarshaler.m */,
267469EA16A1C226006A6A81 /* MMRecordProtoRecord.h */,
Expand Down Expand Up @@ -565,6 +568,7 @@
55F95227165C76370060851E /* Post.m in Sources */,
55F9522A165C76920060851E /* ADNRecord.m in Sources */,
55AA517018BF997F00F54E80 /* CoverImage.m in Sources */,
2648FBEA195B0861009A6CBB /* MMRecordDebugger.m in Sources */,
55F95243165C77380060851E /* AFHTTPClient.m in Sources */,
55F95244165C77380060851E /* AFHTTPRequestOperation.m in Sources */,
55F95245165C77380060851E /* AFImageRequestOperation.m in Sources */,
Expand Down
6 changes: 0 additions & 6 deletions MMRecord.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 7 additions & 34 deletions Source/MMRecord/MMRecord.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@

#import <CoreData/CoreData.h>

#import "MMRecordErrors.h"
#import "MMRecordLoggers.h"
#import "MMRecordDebugger.h"
#import "MMRecordProtoRecord.h"

/** To provide custom parsing functionality for your records, such as the setting a custom key or
Expand Down Expand Up @@ -51,18 +50,6 @@ extern NSString * const MMRecordAttributeAlternateNameKey;

@class MMRecordOptions, MMServer, MMServerPageManager;

/**
Use the method below to set the MMRecord Logging Level. The default logging level is none.
MMRecord can support Cocoa Lumberjack. Logging level is ignored when Cocoa Lumberjack is used.
*/

typedef NS_ENUM(NSInteger, MMRecordLoggingLevel) {
MMRecordLoggingLevelNone = 0,
MMRecordLoggingLevelInfo = 1,
MMRecordLoggingLevelDebug = 2,
MMRecordLoggingLevelAll = 999
};

/**
`MMRecord` provides a pattern for interfacing with a server to retrieve records. A record is
an object that lives on a server. MMRecord depends on the interface from MMServer for making
Expand Down Expand Up @@ -451,15 +438,6 @@ typedef NS_ENUM(NSInteger, MMRecordLoggingLevel) {

- (id)primaryKeyValue;

/**
This helper method returns a custom error and description that describes error conditions in
MMRecord.
@param errorCode MMRecordErrorCode value for this error.
@param description String to be contained in this error's UserInfo dictionary.
*/
+ (NSError *)errorWithMMRecordCode:(MMRecordErrorCode)errorCode description:(NSString *)description;

@end


Expand Down Expand Up @@ -555,11 +533,6 @@ typedef NS_ENUM(NSInteger, MMRecordLoggingLevel) {
@end


@interface MMRecordErrorHandler : NSObject

@end


/**
This block should be used to conditionally delete orphaned records if they are not returned in a
request's response.
Expand Down Expand Up @@ -686,15 +659,15 @@ typedef void (^MMRecordOptionsRecordPrePopulationBlock)(MMRecordProtoRecord *pro
@property (nonatomic, strong) Class pageManagerClass;

/**
This option allows you to specify your own error handling class for implementing custom error
handling behavior. You might want to do this if you want to override certain MMRecord errors, or
This option allows you to specify your own debugger class for implementing custom error handling
behavior. You might want to do this if you want to override certain MMRecord errors, or
more strictly enforce errors of your own. You may also be able to provide support for custom
errors. The MMRecordErrorHandler class and error handling system may grow more powerful
overtime, possibly obviating the need for this, but also possibly making this even more useful.
errors. The MMRecordDebugger class and error handling system may grow more powerful overtime,
possibly obviating the need for this, but also possibly making this even more useful.
@discussion Default value for this is an instance of MMRecordErrorHandler.
@discussion Default value for this is an instance of MMRecordDebugger.
*/
@property (nonatomic, strong) MMRecordErrorHandler *errorHandler;
@property (nonatomic, strong) MMRecordDebugger *debugger;

/**
This option allows you to specify a block that will be executed once per record which was orphaned
Expand Down
Loading

0 comments on commit 7a3f23b

Please sign in to comment.