Last post Dec 02, 2013 11:36 AM by ossprologix
Dec 02, 2013 05:56 AM|ossprologix|LINK
I was wondering isn't throwing exceptions for business logic more readable in code besides error codes?
I also did some search on exception cost. It seems it hits performance badly.
Is this still relevant in 4.5 Framework?
Dec 02, 2013 06:02 AM|PatriceSc|LINK
Sure but they should "exceptionally" happen. If you want to report something that is part of your normal operation use return codes (for example File.Exists). If you want to tell the caller something goes wrong and shoudln't have happened, use an exception
(for example trying to read a file that doesn't exists).
Dec 02, 2013 11:36 AM|ossprologix|LINK
seems like i will go for exceptions whenever my webservice aint able to create docs in sharepoint or critical SQL failures. other bunch of business validations will be wrapped ServiceResult
Thanks for clearing up my mind.