This project is read-only.

Structured Exceptions

May 22, 2014 at 1:19 PM
I understand the design decisions that led to a single, unstructured FaultException being thrown back to the client, but I have a situation in which structure is, in fact, the right thing to do. I have an internal web site, and a partner web site which will communicate with services I expose. Why there are two web sites is another discussion, but suffice to say that decision pre-dates my involvement, and won't be changing.

Since both sites are doing essentially the same thing, it makes sense to move the validation down to the layer that they have in common. That would be the service layer. I would like to return the validation errors in such a way that they can be added to the model and displayed in the normal validation summary.

This could also be useful if you had, for instance, a customer-facing web site, and an internal desktop application, or maybe a mobile application. Anywhere that you have multiple front-ends would benefit from shared validation, ensuring that the same rules are applied consistently across multiple front-ends.

Before I go tearing into the code, I was wondering if you knew of any existing implementations like this. If not, then this project has still saved me a significant amount of time. Thank you.