No Data Found (DataPortalException)

No Data Found (DataPortalException)

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


sanramon posted on Friday, August 10, 2007

    Hi Rocky et al,

I am using CSLA with database being Oracle. I am using Codesmith to generate CSLA classes (templates I converted to read Oracle).

My question is when there is No Data Found in a fetch it throws a DataPortalException, which is very generic in nature for the application. Is there a easy way (DataPortalResult etc), to figure from the DataPortalException thrown that is a No Data Found issue.

Many thanks, this is a great framework.

RockfordLhotka replied on Friday, August 10, 2007

Yes, look at the BusinessException property of the DataPortalException to get the actual exception that triggered the problem.

JoeFallon1 replied on Monday, August 13, 2007

I assume you as the developer are the one throwing the exception.

So you can make your own life easier if you decide up front if you just want to throw a New ApplicationException("No data found".)

Or else create a new Exception named NoDataFoundException and throw one of those.

Then in your UI you can catch the DataPortalException and get the inner exception and see what type it is - or if it has the string you expect - "No data found".

Joe

 

Copyright (c) Marimer LLC