Package org.apache.sling.api.resource

# Class PersistenceException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.io.IOException
org.apache.sling.api.resource.PersistenceException

All Implemented Interfaces:
  `Serializable`

public class PersistenceException extends IOException
This exception will be thrown during the commit to persist changes to a `PersistableValueMap`, a `ModifiableValueMap` or the `ResourceResolver`.

See Also:
  - Serialized Form

## Constructor Summary

Constructors
Constructor
Description
`PersistenceException()`
Create a new persistence exception.
`PersistenceException(String msg)`
Create a new persistence exception.
`PersistenceException(String msg, Throwable cause)`
Create a new persistence exception.
`PersistenceException(String msg, Throwable cause, String resourcePath, String propertyName)`
Create a new persistence exception.

## Method Summary

Modifier and Type
Method
Description
`String`
`getPropertyName()`
Get the property name related to this exception.
`String`
`getResourcePath()`
Get the resource path related to this 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

### PersistenceException

public PersistenceException()
Create a new persistence exception.

### PersistenceException

public PersistenceException(String msg)
Create a new persistence exception.

Parameters:
  `msg` - Exception message.

### PersistenceException

public PersistenceException(String msg, Throwable cause)
Create a new persistence exception.

Parameters:
  `msg` - Exception message.
  `cause` - Exception cause.

### PersistenceException

public PersistenceException(String msg, Throwable cause, String resourcePath, String propertyName)
Create a new persistence exception.

Parameters:
  `msg` - Exception message.
  `cause` - Exception cause.
  `resourcePath` - The optional resource path
  `propertyName` - The optional property name

## Method Details

### getResourcePath

public String getResourcePath()
Get the resource path related to this exception.

Returns:
  The resource path or `null`
Since:
  2.2 (Sling API Bundle 2.2.0)

### getPropertyName

public String getPropertyName()
Get the property name related to this exception.

Returns:
  The property name or `null`
Since:
  2.2 (Sling API Bundle 2.2.0)