Is there an NS* constant for "many found"?

时间:2015-05-04 19:26:32

标签: objective-c error-handling runtime-error semantics error-code

I am writing a method that performs an action which will give us an array of NSErrors. After this, we must handle the returned array:

  1. If the array is empty, no error has occurred and we continue as normal
  2. If the array has one item, that is the culprit so we alert the user, pass it in an NSError (with code: culprit.code) to a device control API that only takes one error, and prematurely return.
  3. If the array has multiple items, we alert the user of all these errors, pass a generic NSError (with code: 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?

0 个答案:

没有答案
相关问题