throwing an exception in objective-c/cocoa

后端 未结 13 1630
耶瑟儿~
耶瑟儿~ 2020-11-29 15:01

What\'s the best way to throw an exception in objective-c/cocoa?

13条回答
  •  旧巷少年郎
    2020-11-29 15:14

    I believe you should never use Exceptions to control normal program flow. But exceptions should be thrown whenever some value doesn't match a desired value.

    For example if some function accepts a value, and that value is never allowed to be nil, then it's fine to trow an exception rather then trying to do something 'smart'...

    Ries

提交回复
热议问题