Silverlight DataPortalException missing BusinessException and BusinessObject

Silverlight DataPortalException missing BusinessException and BusinessObject

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


AaronH posted on Tuesday, March 22, 2011

Hi Rocky,

A couple things:

I'm reading through the rough draft of the Data Access ebook (CSLA 4), and have come to the section on DataPortal Exceptions.  This section is a bit confusing, as you state that the DataPortalException contains the BusinessException and BusinessObject members.  However, these members do not exist for the SL DataPortalException.  Maybe you might consider mentioning that so the reader isn't confused?

Also, what is the best or recommended way to capture the originating exception type from a SL client?  I'm trying to throw a custom exception on the server side within a business object, and I would like the client to act accordingly if that custom exception is found within the DataPortalException.

Thanks!

RockfordLhotka replied on Tuesday, March 22, 2011

That is a good point Aaron, I have forwarded this post to errata@lhotka.net so it gets added to the list of items that need to be addressed.

To answer your question, the .NET exception types can't flow back to Silverlight. Silverlight doesn't have most of the same types. So the data portal tears apart the server-side exception hierarchy and uses it to create a type-safe hierarchy with much the same information. I believe the property is called ErrorInfo (?).

You can use the text-based information in that object graph to determine the exception(s) that occurred on the server.

Copyright (c) Marimer LLC