>Exceptions? Nah, multiple returns! Dependency management? Who needs it... Oh, wait.
I thought consensus was that exceptions, like OOP, is an antipattern. I guess there's room for different opinions. :-/
I thought consensus was that exceptions, like OOP, is an antipattern. I guess there's room for different opinions. :-/
They are still much better than the older patterns they were created to replace, like multiple return.
I see no advantage of returning error types over checked exceptions. I'm happy to be informed, though.
Where a function may return zero, non-zero, not-ERROR_SUCCESS, INVALID_HANDLE, NULL, (there's more), to indicate an error. You then need to call GetLastError which gives you a number that you input into google to get a generic error message.
You "should" also wrap every api call in this error checking so you know where the failure began.