Handling Exceptions in Dal
I like this recommendation text I attached, about the way we should consider to handle our Dal exception/s because its very clear, simple and convincing.
The following attach text is from a one of the architecture guide within the Microsoft architecture web site. The article include more goodies
.
From: Designing Data Tier Components and Passing Data Through Tiers
"Recommendations for Managing Exceptions in a Data Access Logic Component
Data access logic components should propagate exceptions, and should wrap exception types only if doing so makes the exception easier for the client to manage. Wrapping the exceptions in two main exception types (technical and business) helps exception handling structure and exception publishing logic for the potentially diverse callers.
Your application should publish exception information. Technical exceptions can be published to a log that is monitored by administrators or by a Windows Management Instrumentation (WMI) monitoring tool like Microsoft Operations Manager. Business exceptions can be published to an application-specific log. In general, allow the exceptions to propagate from your Data Access Logic Component and be published by the caller so that you have the entire context of the exception.
The following example illustrates these recommendations:
public class CustomerDALC
{
public void UpdateCustomer(Dataset aCustomer)
{
try
{
// Update the customer in the database...
}
catch (SqlException se)
{
// Catch the exception and wrap, and rethrow
throw new DataAccessException("Database is unavailable", se);
}
finally
{
// Cleanup code
}
}
}
"