MBExpressionError Class Reference
| Inherits from | NSObject |
|---|---|
| Declared in | MBExpressionError.h |
Properties
message
Returns a message explaining the error.
@property (nullable, nonatomic, readonly) NSString *messageDeclared In
MBExpressionError.h
causedByError
If the receiver was caused by an underlying NSError, this property will
contain the original error. Otherwise, nil.
@property (nullable, nonatomic, readonly) NSError *causedByErrorDeclared In
MBExpressionError.h
causedByException
If the receiver was caused by an underlying NSException, this property
will contain the original exception. Otherwise, nil.
@property (nullable, nonatomic, readonly) NSException *causedByExceptionDeclared In
MBExpressionError.h
additionalErrors
Returns an array of MBExpressionErrors related to the receiver. May
be nil.
@property (nullable, nonatomic, readonly) NSArray *additionalErrorsDeclared In
MBExpressionError.h
value
Stores an arbitrary value related to the error.
@property (nullable, nonatomic, strong) id valueDeclared In
MBExpressionError.h
offendingExpression
Stores a reference to the MBML expression in which the error occurred.
@property (nullable, nonatomic, strong) NSString *offendingExpressionDeclared In
MBExpressionError.h
offendingToken
Stores a reference to an MBMLParseToken involved in the error, which
is useful for pinpointing the problematic portion of the
offendingExpression.
@property (nullable, nonatomic, strong) MBMLParseToken *offendingTokenDeclared In
MBExpressionError.h
Creating instances
+ errorWithMessage:error:
Creates a new MBExpressionError instance to represent an underlying
NSError.
+ (nonnull instancetype)errorWithMessage:(nonnull NSString *)msg error:(nullable NSError *)nsErrParameters
msg |
The error message. |
|---|---|
nsErr |
The |
Return Value
A new MBExpressionError.
Declared In
MBExpressionError.h
+ errorWithMessage:exception:
Creates a new MBExpressionError instance to represent an underlying
NSException.
+ (nonnull instancetype)errorWithMessage:(nonnull NSString *)msg exception:(nullable NSException *)exParameters
msg |
The error message. |
|---|---|
ex |
The |
Return Value
A new MBExpressionError.
Declared In
MBExpressionError.h
+ errorWithFormat:
Creates a new MBExpressionError instance containing a message constructed
from the specified format string and parameters.
+ (nonnull instancetype)errorWithFormat:(nonnull NSString *)format, ...Parameters
format |
The format for the error message, followed by zero or more format parameters. |
|---|---|
... |
A variable argument list of zero or more values referenced
within the |
Return Value
A new MBExpressionError.
Declared In
MBExpressionError.h
+ errorWithError:
Creates a new MBExpressionError instance to represent an underlying
NSError.
+ (nonnull instancetype)errorWithError:(nonnull NSError *)nsErrParameters
nsErr |
The |
|---|
Return Value
A new MBExpressionError.
Declared In
MBExpressionError.h
+ errorWithException:
Creates a new MBExpressionError instance to represent an underlying
NSException.
+ (nonnull instancetype)errorWithException:(nonnull NSException *)exParameters
ex |
The |
|---|
Return Value
A new MBExpressionError.
Declared In
MBExpressionError.h
Error logging
Reporting errors
– reportErrorTo:
Reports the receiving error. The behavior of reporting depends on the contents
of the reportTo parameter:
- (void)reportErrorTo:(MBExpressionErrorPtrPtr)reportToParameters
reportTo |
Determines where the receiver will be reported. |
|---|
Discussion
If
reportToisnil, the receiver will be logged to the console using thelogmethod.If
reportTois non-nilbut*reportToisnil, the memory location pointed to by*reportTowill be updated to contain the receiver.If
reportTois a non-nilpointer to anMBExpressionErrorinstance the receiver will be reported to that error, meaning the receiver becomes itslastErrorReported.
Declared In
MBExpressionError.h
– reportErrorTo:suppressLog:
Reports the receiving error. The behavior of reporting depends on the contents
of the reportTo parameter:
- (void)reportErrorTo:(MBExpressionErrorPtrPtr)reportTo suppressLog:(BOOL)suppressLogParameters
reportTo |
Determines where the receiver will be reported. |
|---|---|
suppressLog |
If |
Discussion
If
reportToisnilandsuppressLogisNO, the receiver will be logged to the console using thelogmethod.If
reportTois non-nilbut*reportToisnil, the memory location pointed to by*reportTowill be updated to contain the receiver.If
reportTois a non-nilpointer to anMBExpressionErrorinstance the receiver will be reported to that error, meaning the receiver becomes itslastErrorReported.
Declared In
MBExpressionError.h
Checking for additional errors
– errorReported
Determines if an error has been reported since the last time the
clearErrorReported method was called.
- (BOOL)errorReportedReturn Value
YES if an error has been reported, NO otherwise.
Discussion
Note that this flag starts out as YES when new object instances are created.
Declared In
MBExpressionError.h
– clearErrorReported
Clears the flag returned by errorReported so that subsequent calls to
errorReported return NO until the next time the receiver’s reportErrorTo
method is called.
- (void)clearErrorReportedDeclared In
MBExpressionError.h
– lastErrorReported
Returns the MBExpressionError most recently reported to the receiver, or
nil if there isn’t one.
- (nullable MBExpressionError *)lastErrorReportedReturn Value
The most recently reported error.
Discussion
Note: Calling the clearErrorReported method does not affect the return
value of this method.
Declared In
MBExpressionError.h