# Class ErrorHandler.Report

Object
Report

Enclosing interface:
  `ErrorHandler`

public static class ErrorHandler.Report extends Object
Information about errors that occurred while reading or writing tiles in an image. A single `Report` may be generated for failures in more than one tiles.

## Multi-threading

This class is safe for use in multi-threading. The synchronization lock is `this`. However, the `LogRecord` instance returned by `getDescription()` is not thread-safe. Operations applied on the `LogRecord` should be inside a block synchronized on the `Report​.this` lock.

Since:
  1.1

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Report()`
  Creates an initially empty report.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `add(Point tile, Throwable error, Supplier<LogRecord> record)`
  Reports an error that occurred while computing an image tile.
  `LogRecord`
  `getDescription()`
  Returns a description of the first error as a log record.
  `Point[]`
  `getTileIndices()`
  Returns indices of all tiles where an error has been reported.
  `boolean`
  `isEmpty()`
  Returns `true` if no error has been reported.

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### Report

    public Report()
    Creates an initially empty report. Error reports can be added by calls to `add(…)`.

- ## Method Details

  - ### isEmpty

    public boolean isEmpty()
    Returns `true` if no error has been reported. This is true only if the `add(…)` method has never been invoked.
    Returns:
      whether this report is empty.

  - ### add

    public boolean add(Point tile, Throwable error, Supplier<LogRecord> record)
    Reports an error that occurred while computing an image tile. This method can be invoked many times on the same `Report` instance.

    #### Logging information

    `Report` creates a `LogRecord` the first time that this `add(…)` method is invoked. The log record is created using the given supplier if non-null. That supplier should set the log level, message, source class name, source method name and logger name. The exception property will be set by this method.
    Parameters:
      `tile` - column (x) and row (y) indices of the tile where the error occurred, or `null` if unknown.
      `error` - the error that occurred.
      `record` - the record supplier, invoked only when this method is invoked for the first time. If `null`, a default `LogRecord` will be created.
    Returns:
      `true` if this is the first time that an error is reported (in which case a `LogRecord` instance has been created), or `false` if a `LogRecord` already exists.

  - ### getTileIndices

    public Point[] getTileIndices()
    Returns indices of all tiles where an error has been reported.
    Returns:
      indices of all tiles in error, or an empty array if none.

  - ### getDescription

    public LogRecord getDescription()
    Returns a description of the first error as a log record. The exception can be obtained by `LogRecord​.getThrown()`. If more than one error occurred, the other errors are reported as suppressed exceptions. The return value is never null unless this report is empty.
    Returns:
      errors description, or `null` if this report is empty.