Example name: Using WebORB Service Exception
Description: This example shows a C# server-side class method, BasicCalcServer.Divide(), catching a verbose .NET error and throwing a terse Weborb.Exceptions.ServiceError instead.
Prerequisites:
Client-side code: Browse  Download
Server-side code: Browse  Download
Feature availability:
  • WebORB for .NET Development Mode
  • WebORB for .NET Community Edition
  • WebORB for .NET Enterprise Edition
Run example:
Key points:
  • This sample shows how you can, on the server side, intercept .NET exceptions and throw, instead, WebORB-derived exceptions.
  • This could be handy in many situations, such as when you wanted to prevent server-side stack-trace information from being available to the client.
  • The Flex client calls BasicCalcServer's Divide() method.
  • Divide() is identical to Quotient(), except that:
    • If a arithmetic exception (such as division by zero) occurs,
    • Then that exception is caught and a Weborb.Exceptions.ServiceException is thrown instead.
    • This, in effect, replaces a detailed .NET exception with a detail-less WebORB exception.
Things to try:
  • Enter zero (0) as the divisor, then press the "=" button to create a divide-by-zero exception.
    • The Fault details text area is populated as a result, but little information is available.
    • Compare the contents of "Fault details" text area in this sample with its contents in the Handle division by zero error sample (after an identical fault). In this sample, no fault details are available; in the other, they are.
See also:
Errata:
  • None yet known.