NSError domains / custom domains - conventions and best practices

前端 未结 1 988
渐次进展
渐次进展 2020-12-30 06:09

NSError requires a domain, which I understand segments the range of error codes.

One would anticipate that there exist somewhere a registry of domain.error code but

1条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-30 06:41

    Apple generally publishes their NS/CFError codes in a header named FrameworkNameErrors.h. For example, Foundation's error codes are in Foundation/FoundationErrors.h. In addition, they generally publish the domain and codes in their documentation for the framework.

    Any independent author of a framework with its own error domain and codes should do the same.

    0 讨论(0)
提交回复
热议问题