FunctionException (Apache Geode 1.6.0)
Date: 2018-04-23

org.apache.geode.cache.execute

## Class FunctionException

- java.lang.Object
- - java.lang.Throwable
  - - java.lang.Exception
    - - java.lang.RuntimeException
      - - org.apache.geode.GemFireException
        - - org.apache.geode.cache.execute.FunctionException

- All Implemented Interfaces:
    java.io.Serializable
  Direct Known Subclasses:
    EmptyRegionFunctionException, FunctionInvocationTargetException

      public class FunctionException
      extends GemFireException

  Thrown to indicate an error or exceptional condition during the execution of Functions in GemFire. This exception can be thrown by GemFire as well as user code, in the implementation of Function.execute(FunctionContext). When FunctionException is thrown in an implementation of Function.execute(FunctionContext), GemFire will transmit it back to, and throw it on, the calling side. For example, if a GemFire client executes a Function on a server, and the function's execute method throws a FunctionException, the server logs the exception as a warning, and transmits it back to the calling client, which throws it. This allows for separation of business and error handling logic, as client code that processes function execution results does not have to deal with errors; errors can be dealt with in the exception handling logic, by catching this exception.

  The exception string provides details on the cause of failure.

  Since:
    GemFire 6.0
  See Also:
    `FunctionService`, Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `FunctionException()` Creates new function exception with given error message.
    `FunctionException(java.lang.String msg)` Creates new function exception with given error message.
    `FunctionException(java.lang.String msg, java.lang.Throwable cause)` Creates new function exception with given error message and optional nested exception.
    `FunctionException(java.lang.Throwable cause)` Creates new function exception given throwable as a cause and source of error message.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addException(java.lang.Throwable cause)` Adds exceptions thrown from different nodes to a ds
    `void` | `addExceptions(java.util.Collection<? extends java.lang.Throwable> ex)` Adds the list of exceptions provided
    `java.util.List<java.lang.Throwable>` | `getExceptions()` Returns the list of exceptions thrown from different nodes

    - ### Methods inherited from class org.apache.geode.GemFireException

      `getRootCause`

    - ### Methods inherited from class java.lang.Throwable

      `addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### FunctionException

          public FunctionException()

      Creates new function exception with given error message.
      Since:
        GemFire 6.5

    - #### FunctionException

          public FunctionException(java.lang.String msg)

      Creates new function exception with given error message.
      Parameters:
        `msg` -
      Since:
        GemFire 6.0

    - #### FunctionException

          public FunctionException(java.lang.String msg,
                                   java.lang.Throwable cause)

      Creates new function exception with given error message and optional nested exception.
      Parameters:
        `msg` -
        `cause` -
      Since:
        GemFire 6.0

    - #### FunctionException

          public FunctionException(java.lang.Throwable cause)

      Creates new function exception given throwable as a cause and source of error message.
      Parameters:
        `cause` -
      Since:
        GemFire 6.0

  - ### Method Detail

    - #### addException

          public void addException(java.lang.Throwable cause)

      Adds exceptions thrown from different nodes to a ds
      Parameters:
        `cause` -
      Since:
        GemFire 6.5

    - #### getExceptions

          public java.util.List<java.lang.Throwable> getExceptions()

      Returns the list of exceptions thrown from different nodes
      Since:
        GemFire 6.5

    - #### addExceptions

          public void addExceptions(java.util.Collection<? extends java.lang.Throwable> ex)

      Adds the list of exceptions provided
      Since:
        GemFire 6.5