Module org.apache.sis.referencing
Package org.apache.sis.referencing.operation.builder

# Class LocalizationGridException

Object
Throwable
Exception
FactoryException
FactoryDataException
LocalizationGridException

All Implemented Interfaces:
  `Serializable`

public class LocalizationGridException extends FactoryDataException
Thrown when a localization grid cannot be computed, presumably because of a problem with grid data. It may be because some grid coordinates are out of CRS domain of validity, causing either `MathTransform` to be thrown or `Double​.NaN` coordinate values to be computed.

## Additional information on exception cause

It is sometimes difficult to determine the root cause of this exception. For example, grid points slightly outside the CRS domain of validity will not necessarily cause a failure. A strategy can be to try to build the grid anyway, and in case of failure declare that the grid was maybe too far from CRS domain of validity. Because the potential causes are better known by the code that wants a localization grid instead of the `LocalizationGridBuilder` class, `LocalizationGridException` provides a `setPotentialCause(CharSequence)` method for allowing top-level code to attach additional information to this exception.

Since:
  1.2
See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `LocalizationGridException()`
  Construct an exception with no detail message.
  `LocalizationGridException(String message)`
  Constructs an exception with the specified detail message.
  `LocalizationGridException(String message, Throwable cause)`
  Constructs an exception with the specified detail message and cause.
  `LocalizationGridException(Throwable cause)`
  Constructs an exception with the specified cause.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `CharSequence`
  `getPotentialCause()`
  Returns the value given to the last call of `setPotentialCause(CharSequence)`.
  `void`
  `setPotentialCause(CharSequence details)`
  Specifies additional information about what may be the cause of this exception.

  ### Methods inherited from class Throwable

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

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### LocalizationGridException

    public LocalizationGridException()
    Construct an exception with no detail message.

  - ### LocalizationGridException

    public LocalizationGridException(String message)
    Constructs an exception with the specified detail message.
    Parameters:
      `message` - the detail message, saved for later retrieval by the `Throwable​.getMessage()` method.

  - ### LocalizationGridException

    public LocalizationGridException(Throwable cause)
    Constructs an exception with the specified cause.
    Parameters:
      `cause` - the cause, saved for later retrieval by the `Throwable​.getCause()` method.

  - ### LocalizationGridException

    public LocalizationGridException(String message, Throwable cause)
    Constructs an exception with the specified detail message and cause. The cause is the exception thrown in the underlying database (e.g. `IOException` or `SQLException`).
    Parameters:
      `message` - the detail message, saved for later retrieval by the `Throwable​.getMessage()` method.
      `cause` - the cause, saved for later retrieval by the `Throwable​.getCause()` method.

- ## Method Details

  - ### setPotentialCause

    public void setPotentialCause(CharSequence details)
    Specifies additional information about what may be the cause of this exception. Example: "The grid spans more than 180° of longitude", which may be a cause of map projection failures.
    Parameters:
      `details` - a potential cause, or `null` if none. The type should be `String` or `InternationalString`.

  - ### getPotentialCause

    public CharSequence getPotentialCause()
    Returns the value given to the last call of `setPotentialCause(CharSequence)`.
    Returns:
      potential cause, or `null` if none. The type should be `String` or `InternationalString`.