Techniques and Considerations for Cleaner Error Handling in your Program
Exceptions should be preferred over error codes as returning error codes will force you to have an “if” statement to check for error code, which may be confusing to some readers and there is also a chance that the caller may forget to check for error codes. If you use error codes, you will also need to have some class that defines all error codes and all classes that use those error codes will be dependent on this class.
Recent comments