I am writing a method that performs an action which will give us an array of NSError
s. After this, we must handle the returned array:
- If the array is empty, no error has occurred and we continue as normal
- If the array has one item, that is the
culprit
so we alert the user, pass it in anNSError
(withcode: culprit.code
) to a device control API that only takes one error, and prematurely return. - If the array has multiple items, we alert the user of all these errors, pass a generic
NSError
(withcode: 0
) to the API, and return.
I want to improve case 3 so that the code (an NSInteger
) is representative of multiple errors having occurred. Is there a standard way to represent this in Objective C, similar to how NSNotFound
represents that none was found?