I'm afraid the only way to do it is setting the customErrors option in your application Web.config file to off, note that if you do this the client will also receive all the exceptions that do not get handled in your pages, not only your webservice's exceptions.
Hope this helps,
Elias.
hello.
well, the problem is that currently all exceptions are wrapped in an WebServiceError class which only receives the exception message, exception stack trace and its type. if you set the customErrors' mode section to off, you'll receive the correct type of exception, but those extra properties won't be serialized.
a possible alternative to this is create a new type that has 2 members: the normal return type of your method and a reference to the exception. then you need to build a new javascriptcoonverter derived class that will be responsible for setting up the properties that should be serialized in your custom deirved exception classes. then you need to handle all the exceptions in your web methods: when you get one, you set the "return type" member of that new type to null and set the exception membe to your custom exception. then, on the client you'll just need to check if your exception prop is null or not...maybe more work that you're willing to have, but it might just work...
Seems like there is no more flexible solution.
Anyway, thank you for advice.
No comments:
Post a Comment