NSError(MBToolbox) Category Reference
Declared in | NSError+MBToolbox.h |
---|
Creating errors in the Mockingbird error domain
+ mockingbirdErrorWithCode:
Constructs a new NSError
instance in the error domain specified by the
kMBErrorDomain
constant.
+ (nonnull NSError *)mockingbirdErrorWithCode:(NSInteger)code
Parameters
code |
The error code. |
---|
Return Value
A new NSError
instance with the specified settings.
Declared In
NSError+MBToolbox.h
+ mockingbirdErrorWithCode:userInfo:
Constructs a new NSError
instance in the error domain specified by the
kMBErrorDomain
constant.
+ (nonnull NSError *)mockingbirdErrorWithCode:(NSInteger)code userInfo:(nullable NSDictionary *)dict
Parameters
code |
The error code. |
---|---|
dict |
The user info dictionary for the returned error. |
Return Value
A new NSError
instance with the specified settings.
Declared In
NSError+MBToolbox.h
+ mockingbirdErrorWithCode:userInfoKey:value:
Constructs a new NSError
instance in the error domain specified by the
kMBErrorDomain
constant.
+ (nonnull NSError *)mockingbirdErrorWithCode:(NSInteger)code userInfoKey:(nonnull NSString *)key value:(nonnull id)val
Parameters
code |
The error code. |
---|---|
key |
The key whose corresponding value will be stored in the returned error’s user info dictionary. |
val |
The value that will be associated with |
Return Value
A new NSError
instance with the specified settings.
Discussion
The error’s user info dictionary will contain the specified key and value.
Declared In
NSError+MBToolbox.h
+ mockingbirdErrorWithDescription:
Constructs a new NSError
instance in the error domain specified by the
kMBErrorDomain
constant.
+ (nonnull NSError *)mockingbirdErrorWithDescription:(nonnull NSString *)desc
Parameters
desc |
The description of the error, which will be available through
the user info key |
---|
Return Value
A new NSError
instance with the specified settings.
Discussion
The error’s code will be kMBErrorMessageInDescription
.
Declared In
NSError+MBToolbox.h
+ mockingbirdErrorWithDescription:code:
Constructs a new NSError
instance in the error domain specified by the
kMBErrorDomain
constant.
+ (nonnull NSError *)mockingbirdErrorWithDescription:(nonnull NSString *)desc code:(NSInteger)code
Parameters
desc |
The description of the error, which will be available through
the user info key |
---|---|
code |
The error code. |
Return Value
A new NSError
instance with the specified settings.
Declared In
NSError+MBToolbox.h
+ mockingbirdErrorWithDescription:code:userInfoKey:value:
Constructs a new NSError
instance in the error domain specified by the
kMBErrorDomain
constant.
+ (nonnull NSError *)mockingbirdErrorWithDescription:(nonnull NSString *)desc code:(NSInteger)code userInfoKey:(nonnull NSString *)key value:(nonnull id)val
Parameters
desc |
The description of the error, which will be available through
the user info key |
---|---|
code |
The error code. |
key |
The key whose corresponding value will be stored in the returned error’s user info dictionary. |
val |
The value that will be associated with |
Return Value
A new NSError
instance with the specified settings.
Discussion
The error’s user info dictionary will contain the specified key and value.
Declared In
NSError+MBToolbox.h
+ mockingbirdErrorWithException:
Constructs a new NSError
instance in the error domain specified by the
kMBErrorDomain
constant.
+ (nonnull NSError *)mockingbirdErrorWithException:(nonnull NSException *)ex
Parameters
ex |
The |
---|
Return Value
A new NSError
instance with the specified settings.
Discussion
The error will encapsulate the passed-in exception.
Declared In
NSError+MBToolbox.h
Creating derived errors
– errorByAddingOrRemovingUserInfoKey:value:
Creates and returns a new NSError
instance based on the receiver by adding
or removing the user info dictionary value for the given key.
- (nonnull NSError *)errorByAddingOrRemovingUserInfoKey:(nonnull NSString *)key value:(nullable id)val
Parameters
key |
The key whose corresponding value will be stored in the returned error’s user info dictionary. |
---|---|
val |
The value that will be associated with |
Return Value
A new NSError
instance with the same settings as the receiver,
but with the specified user info value added.
Declared In
NSError+MBToolbox.h