How to catch exception occured in DAL of ObjectDataSource object?
<p>I have ObjectDataSource and GridView on one of the pages of my asp.net web project.</p>

<p>To initialize ObjectDataSource i use Init event:</p>

<pre><code>   protected void ObjectDataSource1_Init(object sender, EventArgs e)
    {
            ObjectDataSource1.EnablePaging = true;
            ObjectDataSource1.TypeName = "CustomerDataSource";
            ObjectDataSource1.DataObjectTypeName = "Customer";
            ObjectDataSource1.SelectMethod = "GetCustomers";
            ObjectDataSource1.UpdateMethod = "Update";
            ObjectDataSource1.SelectCountMethod = "GetCustomersCount";
            ObjectDataSource1.MaximumRowsParameterName = "maximumRows";
            ObjectDataSource1.StartRowIndexParameterName = "startRowIndex";

      }
</code></pre>

<p>Somewhere in DAL:</p>

<pre><code>public static List&lt;Customer&gt; GetCustomers(int maximumRows, int startRowIndex)
{
   try {
         ... some select to database here...
       }
       catch (Exception ex)
       {
         Utils.LogError(ex);
         throw ex;
       }
}
</code></pre>

<p>Now let's imagine that GetCustomers for some reason throws an exception. How could i catch this exception and handle it? I know i can use Application_Error, but i would like to catch this exception somehow on my page and show some friendly message to the user. Is that possible?</p>

<p>Thanks</p>
