Package groovy.lang

# Class ClosureException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
groovy.lang.ClosureException

All Implemented Interfaces:
  `Serializable`

public class ClosureException extends RuntimeException
An exception thrown by a closure invocation

See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ClosureException(Closure closure, Throwable cause)`
  Creates a new closure exception.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Closure`
  `getClosure()`
  Returns the closure that threw the exception.

  ### 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 Details

  - ### ClosureException

    public ClosureException(Closure closure, Throwable cause)
    Creates a new closure exception.
    Parameters:
      `closure` - the closure that failed
      `cause` - the underlying cause

- ## Method Details

  - ### getClosure

    public Closure getClosure()
    Returns the closure that threw the exception.
    Returns:
      the failing closure