Spatial DataBlade
JAVA API v8.21

com.ibm.spatial
Interface ErrorHandler

All Known Implementing Classes:
HandlerImpl

public interface ErrorHandler

Basic interface for Spatial API error handlers.

If a spatial application needs to implement customized error handling, it must implement this interface and then register an instance with the SpatialManager using the setErrorHandler method. The API will then report all errors and warnings through this interface.

If an application does not register an ErrorHandler, a default error handler is used.

See Also:
SpatialManager.setErrorHandler(com.ibm.spatial.ErrorHandler)

Method Summary
 void fatalError(java.lang.Exception exception)
          Receive notification of a non-recoverable error.
 java.lang.Exception recoverableError(java.lang.Exception exception)
          Receive notification of a recoverable error.
 java.lang.Exception warning(java.lang.Exception exception)
          Receive notification of a warning.
 

Method Detail

recoverableError

java.lang.Exception recoverableError(java.lang.Exception exception)

Receive notification of a recoverable error. A recoverable error may occur for example when the API encounters an invalid geometry while reading several geometries from a shape file. The handler implementation may decide to recover from reading the invalid geometry and continuing to the next one, in which case it should return null. Otherwise, the API will throw the exception returned by this function.

It is still possible for the API to continue to run the current operation after this error occurs. For cases where the API can't continue, it will report a fatal error.

Parameters:
exception - The fatal error information encapsulated in a SpatialException, or a subclass of RuntimeException.
Returns:
The original exception, or a new exception built by this function. The new exception must have the same type as the exception passed as argument.

fatalError

void fatalError(java.lang.Exception exception)
Receive notification of a non-recoverable error. The API will throw the exception passed as argument after this function returns.

This type of error is used to signal that the API cannot continue the current operation after this error occurs.

Parameters:
exception - The fatal error information encapsulated in a SpatialException, or a subclass of RuntimeException.
See Also:
SpatialException

warning

java.lang.Exception warning(java.lang.Exception exception)
Receive notification of a warning. The handler implementation may decide to stop the execution of the current command, in which case it should return a non-null exception.

It is still possible for the API to continue to run the current operation after this error occurs. For cases where the API can't continue, it will report a fatal error.

Parameters:
exception - The fatal error information encapsulated in a SpatialException
Returns:
The original exception, or null to indicate continuation of the execution of the current API operation. The new exception must have the same type as the exception passed as argument.
See Also:
SpatialException

Spatial DataBlade
JAVA API v8.21


Licensed Materials - Property of IBM
Copyright IBM Corp. 2002, 2012 All Rights Reserved.