concept exception in category system administration

appears as: exceptions, n exception, exception, exception, exceptions
Functional and Reactive Domain Modeling

This is an excerpt from Manning's book Functional and Reactive Domain Modeling.

  • Listing 1.6 uses a few other constructs such as Try, Success, and Failure that are more functional and compositional than throwing exceptions. The upcoming sidebar “Exceptions in Scala” gives an overview of handling exceptions functionally in Scala. Later chapters also cover this topic, as they detail functional programming patterns.
  • Tuscany SCA in Action

    This is an excerpt from Manning's book Tuscany SCA in Action.

  • Processing the payment— The makePayment operation uses a third-party credit card processing service to validate Mary’s credit card details and ensure that she has enough funds to make the payment. Everything is fine, so the makePayment operation returns to Mary’s client software, confirming that the payment was accepted. In the event of a problem with the payment, the makePayment operation would throw an exception back to the client, with the exception type and exception data giving details of the payment problem.
  • When an SCA component interacts with other services, error conditions may occur. In general, there are two types of exceptions: business exceptions and SCA runtime exceptions. We’ll cover both how to define and handle business exceptions and how to handle SCA runtime exceptions, so let’s start by looking at business exceptions.

    public class CustomerNotFoundException extends Exception {
    private String customerId;
    ...
    }

    We can then extend the service interface to indicate that this service may return this exception under certain conditions. Because we’re working with implementation.java, and the service interface is described in the Java language, this is a matter of adding the exception to appropriate operations in the Java CustomerRegistry interface.

    Of these, the best practice is to catch the exception and either throw it as a business exception described explicitly on your service interface or initiate a compensating action if you’ve designed your components to work in this way. Allowing system exceptions to work their way back through the stack of calling component references and services can be problematic. There’s a good chance that system details from deep within the call stack will be exposed in unexpected places, with the obvious implications for security.