NSError Is NSAwful
Is it just me, or is NSError one of the worst features of the cocoa framework? Who thought these are these better than exceptions? Don’t developers see that these are just fancy return codes? Here are some major problems:
- Most developers don’t handle errors. Exceptions add due pressure to not let things slip. With ‘NSError’ it is so easy to pass NULL or never check the return.
- Mobile devices don’t have any easy way to display errors. Sure desktop applications have ‘NSApp’ that can present them, but what about mobile users?
- Most documents don’t detail what errors can occur. For example, the documentation for ‘NSFetchedResultsController’ states ‘contains an error object that describes the problem’. Great.