When requests to the EntityServer fail (including query and save requests), the server-side exception is wrapped in an EntityServerException and sent back to the client. Understanding the EntityServerException can help in debugging application problems. You may be able to catch the exception and recover - an option that begins with listening to the EntityManager.EntityServerError event.
If a request to the EntityServer fails the exception returned to the client application will be wrapped in an EntityServerException. Your application might receive the base EntityServerException, or one of the custom sub-types:
While the text of the exception message isn't always helpful, since exceptions can bubble up through many layers, in not only DevForce but in .NET and other assemblies, you'll often have to look at other details in the exception to understand the problem.
All EntityServerExceptions will have this information:
For failures occurring on the EntityServer in an n-tier application the InnerException will often be empty because that information is not serialized to the client. Instead, several other properties will contain this information:
If the InnerException is present, drilling down into it and all nested inner exceptions can help determine the original cause of the failure.
You should wrap all calls to the EntityServer with try/catch logic.
For queries and saves, you can optionally use one of the "try/result" methods:
The EntityManager also provides a central error handling facility for EntityServerExceptions. The EntityServerError event will be raised as a "first chance" handler for any exceptions before they are thrown. In your event handler you can mark the exception as handled so that it will not be re-thrown.