Package groovy.lang

# Class MissingPropertyException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
groovy.lang.GroovyRuntimeException
groovy.lang.MissingPropertyException

All Implemented Interfaces:
  `Serializable`

Direct Known Subclasses:
  `IllegalPropertyAccessException`, `MissingPropertyExceptionNoStack`, `ReadOnlyPropertyException`

public class MissingPropertyException extends GroovyRuntimeException
An exception occurred if a dynamic property dispatch fails with an unknown property.

Note that the Missing*Exception classes were named for consistency and to avoid conflicts with JDK exceptions of the same name.

See Also:
  - Serialized Form

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final Object`
  `MPE`
  Sentinel used internally when handling missing properties.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `MissingPropertyException(String message)`
  Creates an exception with a custom message.
  `MissingPropertyException(String property, Class type)`
  Creates an exception for a missing property.
  `MissingPropertyException(String property, Class type, Throwable cause)`
  Creates an exception for a missing property with an underlying cause.
  `MissingPropertyException(String message, String property, Class type)`
  Creates an exception with a custom message for a missing property.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getMessageWithoutLocationText()`
  Returns the detail message without any location suffix.
  `String`
  `getProperty()`
  `Class`
  `getType()`

  ### Methods inherited from class groovy.lang.GroovyRuntimeException

  `getLocationText, getMessage, getModule, getNode, setModule`

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

  `addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, 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`

- ## Field Details

  - ### MPE

    public static final Object MPE
    Sentinel used internally when handling missing properties.

- ## Constructor Details

  - ### MissingPropertyException

    public MissingPropertyException(String property, Class type)
    Creates an exception for a missing property.
    Parameters:
      `property` - the missing property name
      `type` - the target type

  - ### MissingPropertyException

    public MissingPropertyException(String property, Class type, Throwable cause)
    Creates an exception for a missing property with an underlying cause.
    Parameters:
      `property` - the missing property name
      `type` - the target type
      `cause` - the underlying cause

  - ### MissingPropertyException

    public MissingPropertyException(String message)
    Creates an exception with a custom message.
    Parameters:
      `message` - the detail message

  - ### MissingPropertyException

    public MissingPropertyException(String message, String property, Class type)
    Creates an exception with a custom message for a missing property.
    Parameters:
      `message` - the detail message
      `property` - the missing property name
      `type` - the target type

- ## Method Details

  - ### getMessageWithoutLocationText

    public String getMessageWithoutLocationText()
    Returns the detail message without any location suffix.
    Overrides:
      `getMessageWithoutLocationText` in class `GroovyRuntimeException`
    Returns:
      the formatted detail message

  - ### getProperty

    public String getProperty()
    Returns:
      the name of the property that could not be found

  - ### getType

    public Class getType()
    Returns:
      the class which cannot answer the property