MBExpressionError Class Reference
Inherits from | NSObject |
---|---|
Declared in | MBExpressionError.h |
Properties
message
Returns a message explaining the error.
@property (nullable, nonatomic, readonly) NSString *message
Declared 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 *causedByError
Declared 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 *causedByException
Declared In
MBExpressionError.h
additionalErrors
Returns an array of MBExpressionError
s related to the receiver. May
be nil
.
@property (nullable, nonatomic, readonly) NSArray *additionalErrors
Declared In
MBExpressionError.h
value
Stores an arbitrary value related to the error.
@property (nullable, nonatomic, strong) id value
Declared In
MBExpressionError.h
offendingExpression
Stores a reference to the MBML expression in which the error occurred.
@property (nullable, nonatomic, strong) NSString *offendingExpression
Declared 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 *offendingToken
Declared 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 *)nsErr
Parameters
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 *)ex
Parameters
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 *)nsErr
Parameters
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 *)ex
Parameters
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)reportTo
Parameters
reportTo |
Determines where the receiver will be reported. |
---|
Discussion
If
reportTo
isnil
, the receiver will be logged to the console using thelog
method.If
reportTo
is non-nil
but*reportTo
isnil
, the memory location pointed to by*reportTo
will be updated to contain the receiver.If
reportTo
is a non-nil
pointer to anMBExpressionError
instance 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)suppressLog
Parameters
reportTo |
Determines where the receiver will be reported. |
---|---|
suppressLog |
If |
Discussion
If
reportTo
isnil
andsuppressLog
isNO
, the receiver will be logged to the console using thelog
method.If
reportTo
is non-nil
but*reportTo
isnil
, the memory location pointed to by*reportTo
will be updated to contain the receiver.If
reportTo
is a non-nil
pointer to anMBExpressionError
instance 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)errorReported
Return 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)clearErrorReported
Declared In
MBExpressionError.h
– lastErrorReported
Returns the MBExpressionError
most recently reported to the receiver, or
nil
if there isn’t one.
- (nullable MBExpressionError *)lastErrorReported
Return 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