MMRecordDebugger Class Reference
Inherits from | NSObject |
Declared in | MMRecordDebugger.h MMRecordDebugger.m |
Overview
This class is intended as the primary access point for debugging model configuration and response handling issues and errors that may occur while building your application with MMRecord. This class is called a Debugger to indicate that it is not intended to be used in production. It is designed to help you while configuring your model and setting up your requests.
You may still use MMRecordDebugger to handle actual errors in a production setting. However, you should also understand that these issues typically should never happen in production, and likely mean that your API has broken or is experiencing unexpected behavior. Please plan accordingly.
MMRecordDebugger combines both error handling and debug logging to provide you with helpful feedback about issues in your model configuration and response handling. The type of errors handled by the debugger are listed above. Those errors will be added to over time to provide even more helpful feedback.
Tasks
-
responseObject
The responseObject returned by the request associated with this debugger.
property -
initialEntity
The initialEntity where the request associated with this debugger started.
property -
loggingLevel
The logging level for the debugger.
property -
– handleErrorCode:withParameters:
This method is the workhorse of the debugger. This method should be called to indicate that an error has been encountered and that it should be tracked by the debugger.
-
– logMessageWithDescription:minimumLoggingLevel:
This method can be used to log a helpful message through the debugger. The message will only be logged if its minimumLoggingLevel is lower than or equal to the current debugger logging level.
-
+ logMessageWithDescription:
This method can be used to log a helpful message through the debugger. This message will be handled in a stateless fashion, and will leverage the current logging level set on MMRecord itself.
-
– primaryError
This is the main error that is associated with this debugger instance. This will be the error that gets shown in an MMRecord failureBlock.
-
– encounteredFailureCondition
This method can be used to determine if a serious error representing a condition that causes MMRecord’s request handling process to fail has occurred. If that has happened then the highest priority error will be present in the primaryError accessor.
-
– parametersWithKeys:values:
Convenience method for setting up a parameters dictionary with keys and values.
Properties
initialEntity
The initialEntity where the request associated with this debugger started.
@property (nonatomic, strong) NSEntityDescription *initialEntity
Discussion
The initialEntity where the request associated with this debugger started.
Declared In
MMRecordDebugger.h
loggingLevel
The logging level for the debugger.
@property (nonatomic) MMRecordLoggingLevel loggingLevel
Discussion
The logging level for the debugger.
@discussion The default for this is the default set on MMRecord. @discussion The default for MMRecord is MMRecordLoggingLevelNone.
Declared In
MMRecordDebugger.h
Class Methods
logMessageWithDescription:
This method can be used to log a helpful message through the debugger. This message will be handled in a stateless fashion, and will leverage the current logging level set on MMRecord itself.
+ (void)logMessageWithDescription:(NSString *)description
Parameters
- description
The message you want to display in the log.
Discussion
This method can be used to log a helpful message through the debugger. This message will be handled in a stateless fashion, and will leverage the current logging level set on MMRecord itself.
Warning: Messages sent to this method will ONLY be logged if the logging level from MMRecord is set to MMRecordLoggingLevelAll. @discussion This method will only log messages when the logging level is set to ALL in order to prevent excessive messages being sent to the console, and also to ensure that only the highest level of logging will include messages sent in a stateless fashion.
Declared In
MMRecordDebugger.h
Instance Methods
encounteredFailureCondition
This method can be used to determine if a serious error representing a condition that causes MMRecord’s request handling process to fail has occurred. If that has happened then the highest priority error will be present in the primaryError accessor.
- (BOOL)encounteredFailureCondition
Return Value
BOOL YES if a failing error has been encountered, otherwise NO.
Discussion
This method can be used to determine if a serious error representing a condition that causes MMRecord’s request handling process to fail has occurred. If that has happened then the highest priority error will be present in the primaryError accessor.
Declared In
MMRecordDebugger.h
handleErrorCode:withParameters:
This method is the workhorse of the debugger. This method should be called to indicate that an error has been encountered and that it should be tracked by the debugger.
- (void)handleErrorCode:(MMRecordErrorCode)errorCode withParameters:(NSDictionary *)parameters
Parameters
- errorCode
The error code to handle.
- parameters
Custom parameters to provide additional information about the error. These parameters will also be included in the error’s userInfo dictionary.
Discussion
This method is the workhorse of the debugger. This method should be called to indicate that an error has been encountered and that it should be tracked by the debugger.
Calling this method will create an NSError object with the appropriate code and error description. An instance of the debugger will also exist in the error’s userInfo dictionary.
Depending on your logging level settings, this error also may or may not be logged to the console.
Declared In
MMRecordDebugger.h
logMessageWithDescription:minimumLoggingLevel:
This method can be used to log a helpful message through the debugger. The message will only be logged if its minimumLoggingLevel is lower than or equal to the current debugger logging level.
- (void)logMessageWithDescription:(NSString *)description minimumLoggingLevel:(MMRecordLoggingLevel)loggingLevel
Parameters
- description
The message you want to display in the log.
- loggingLevel
The minimum logging level for the log message.
Discussion
This method can be used to log a helpful message through the debugger. The message will only be logged if its minimumLoggingLevel is lower than or equal to the current debugger logging level.
Declared In
MMRecordDebugger.h
parametersWithKeys:values:
Convenience method for setting up a parameters dictionary with keys and values.
- (NSDictionary *)parametersWithKeys:(NSArray *)keys values:(NSArray *)values
Parameters
- keys
An array of MMRecordDebuggerParameter keys
- values
An array of objects to associate with the given keys.
Discussion
Convenience method for setting up a parameters dictionary with keys and values.
Declared In
MMRecordDebugger.h
primaryError
This is the main error that is associated with this debugger instance. This will be the error that gets shown in an MMRecord failureBlock.
- (NSError *)primaryError
Return Value
NSError an error object with an MMRecord error code and domain.
Discussion
This is the main error that is associated with this debugger instance. This will be the error that gets shown in an MMRecord failureBlock.
Declared In
MMRecordDebugger.h