Good Afternoon All,
I am currently pondering over the best exception handling approach for some of my business objects. These objects all return EntityColletions<T> according to a RelationPredicateBucket which is passed to them.
Generally I would like to catch all exceptions caused by database operations and stop the program from crashing. I would however like to inform the user of the reason the requested operation was unsuccessful.
There are two different approaches I can see at the moment:
Wrapping the Collection in a wrapper class which includes a bool returning true if an error occurred as well as the exception itself if thrown. This class is passed to the calling object and dealt with accordingly.
Or
Let the exception bubble up into the calling object and deal with it there (outside the business layer).
Any opinions on what would be preferable? Also at the moment I am catching two exceptions: SqlClient.SqlException and ORMSupportClasses.ORMException. Will these two exception cover all database operations?
Regards,
Mike