# Class IncompatibleResourceException

Object
Throwable
Exception
DataStoreException
IncompatibleResourceException

All Implemented Interfaces:
  `Serializable`, `LocalizedException`

public class IncompatibleResourceException extends DataStoreException
Thrown when a write operation cannot be performed because the resource to write is incompatible with the data store. For example, the file format may have restrictions that prevent the encoding of the coordinate reference system used by the resource. The `getAspects()` method can help to identify which aspects (class, CRS, etc.) are the causes of the incompatibility.

Since:
  1.2
See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `IncompatibleResourceException()`
  Creates an exception with no cause and no details message.
  `IncompatibleResourceException(String message)`
  Creates an exception with the specified details message.
  `IncompatibleResourceException(String message, Throwable cause)`
  Creates an exception with the specified details message and cause.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `IncompatibleResourceException`
  `addAspect(String name)`
  Adds an identification of the aspect which is the cause of the incompatibility.
  `Set<String>`
  `getAspects()`
  Returns identifications of the aspects which are causes of the incompatibility.

  ### Methods inherited from class DataStoreException

  `getInternationalMessage, getLocalizedMessage, getMessage, initCause`

  ### Methods inherited from class Throwable

  `addSuppressed, fillInStackTrace, getCause, getStackTrace, getSuppressed, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### IncompatibleResourceException

    public IncompatibleResourceException()
    Creates an exception with no cause and no details message.

  - ### IncompatibleResourceException

    public IncompatibleResourceException(String message)
    Creates an exception with the specified details message.
    Parameters:
      `message` - the detail message.

  - ### IncompatibleResourceException

    public IncompatibleResourceException(String message, Throwable cause)
    Creates an exception with the specified details message and cause.
    Parameters:
      `message` - the detail message.
      `cause` - the cause for this exception.

- ## Method Details

  - ### addAspect

    public IncompatibleResourceException addAspect(String name)
    Adds an identification of the aspect which is the cause of the incompatibility. It should be the name of a property such as `"crs"` or `"gridToCRS"`. See `getAspects()` for a list of suggested values.
    Parameters:
      `name` - an identification of the aspect which is incompatible.
    Returns:
      `this` for method call chaining.
    Since:
      1.5

  - ### getAspects

    public Set<String> getAspects()
    Returns identifications of the aspects which are causes of the incompatibility. Some values are:
    - `"class"`: the resources is not an instance of the class expected by the writer.
    - `"crs"`: the coordinate reference system cannot be encoded.
    - `"gridToCRS"`: the "grid to CRS" component of the grid geometry of a raster cannot be encoded.
    - `"gridGeometry"`: the grid geometry of a raster cannot be encoded for reason less specific than `gridToCRS`.
    - `"raster"`: the raster data cannot be encoded.
    - `"unit"`: the unit of measurement cannot be encoded.
    Returns:
      identifications of aspects which are incompatible.
    Since:
      1.5