Despite reading many articles (some on this board) I am still scratching my head wondering when the appropriate time to use an exception would be. I don’t see many methods returning error codes in the platform API, but some people still insist that exceptions should only be used for exceptional events that require control flow to jump specifically. I have been using exceptions to handle generic conditional assertions in my programs. Is this bad practice? Or should I use the old method of returning an error code for generic failures?
Share
Yes, use validation instead.
No, use an exception instead.
So, it should be ( just saying )
Instead of :
And it should be:
Instead of: