Skip to main content
Microsoft Silverlight
Home Forums Silverlight Programming WCF RIA Services How do you properly pass an exception from server to client?
6 replies. Latest Post by enantiomer2000 on August 25, 2009.
(0)
enantiom...
Member
45 points
62 Posts
08-25-2009 2:39 PM |
I have a class that extends the AuthorizationAttribute class so that I can do my own authorization for my application. Everything is all set up very nicely BUT if the user isn't authorized to call the DomainService method, I want to have my client receive my own exception. Currently the only exception I ever see is EntityOperationException. EntityOperationException just has the Message string from my original exception, but doesn't have any InnerException (it is null).
How can I pass exceptions from server to client? I would rather not try to parse the Message property string to interpret my error. Any ideas? I can't find anything about this in the documentation.
Thanks.
Sledge70
Contributor
7426 points
1,285 Posts
08-25-2009 3:52 PM |
Have you enabled includeExceptionDetailsInFaults for wcf?
<serviceDebug includeExceptionDetailInFaults="true"/>
This will at least get the inner exception populated.
08-25-2009 4:08 PM |
Does that work for a DomainService? I am not calling a WCF service directly here. Where would you set the DomainService to use the behavior? Is this the type of setting you would want to use for a production environment?
ColinBlair
Star
11673 points
2,103 Posts
08-25-2009 4:20 PM |
enantiomer2000: Does that work for a DomainService? I am not calling a WCF service directly here. Where would you set the DomainService to use the behavior? Is this the type of setting you would want to use for a production environment?
Not at the moment, as soon as the ADO.NET Services hosted version of RIA Services shows up then that will change.
08-25-2009 4:34 PM |
@ColinBlair
Thanks for the info. So for now the best thing to do is probably to pass a DomainServiceException with an error code?
"as soon as the ADO.NET Services hosted version of RIA Services shows up.."
Can you explain this more? Do you mean when it goes live and is integrated into ADO.Net Services? The entity framework guys have a blog where you can keep up to date with the latest developments, do the RIA Services guys have one too?
08-25-2009 5:19 PM |
enantiomer2000:Thanks for the info. So for now the best thing to do is probably to pass a DomainServiceException with an error code?
Yes
enantiomer2000:Can you explain this more? Do you mean when it goes live and is integrated into ADO.Net Services? The entity framework guys have a blog where you can keep up to date with the latest developments, do the RIA Services guys have one too?
RIA Services will be integrated with ADO.NET Data Services by the PDC timeframe. When that happens WCF configuration will start working since ADO.NET Data Services is WCF based. Currently RIA Services is running on a plain HTTPHandler and there really isn't much plumbing in there.
There is no RIA Services blog (well, other than mine), just lots of individual blogs and twitters. I just got started on twitter and I try to re-tweet anything RIA Services related that comes by.
08-25-2009 5:27 PM |
Thanks for the info. Guess I will have to check this Twitter thing out too.