override DataPortal_OnDataPortalException

override DataPortal_OnDataPortalException

Old forum URL: forums.lhotka.net/forums/t/8601.aspx

greengumby posted on Wednesday, March 03, 2010

Hi Rocky,

I wish to be able to take the innerexception of a DataPortalException and use the Microsoft Exception Handling Block to replace the exception and pass to client.

Ultimate goal is to strip off the DataPortalException at the Silverlight end and have all the obtuse exceptions server side to be converted to a user friendly one.

Initially I was hoping to override

 protected virtual void DataPortal_OnDataPortalException(DataPortalEventArgs e, Exception ex)

However the calling code

catch (Exception ex)




          if (target != null)


              new DataPortalEventArgs(context, objectType, operation), ex);




              new DataPortalEventArgs(context, objectType, operation), ex);




          // ignore exceptions from the exception handler


        throw new DataPortalException(

          "DataPortal.Update " + Resources.FailedOnServer, 

          ex, new DataPortalResult(obj));



ignores exceptions being thrown from the handler and also does not allow me to set ex.

Would it be appropriate to make ex a ref parameter allowing this functionality otherwise have you got any suggestions on how I can achieve this.

Many Thanks


RockfordLhotka replied on Wednesday, March 03, 2010

Are you asking about the issue reported here:


Right now it is not possible to alter the exception as it flows back to the client. I hope to rework the pipeline model of the data portal in CSLA 4 to enable that scenario, but I don't know if I'll have time or not at this point...

greengumby replied on Thursday, March 04, 2010

Thanks Rocky,

The link you sent for the feature request is correct. 

I altered CSLA so that the ex parameter is now a ref and it currently performs as I expect but obviously will take a refactoring hit when we upgrade CSLA in the future.

Thanks again


Copyright (c) Marimer LLC