scriptella.spi
Class ProviderException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by scriptella.core.SystemException
                  extended by scriptella.spi.ProviderException
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
JdbcException

public abstract class ProviderException
extends SystemException

Thrown by connection provider to indicate any kind of failure.

Service Providers must provide subclasses of this exception.

Version:
1.0
Author:
Fyodor Kupolov
See Also:
Serialized Form

Constructor Summary
ProviderException()
           
ProviderException(java.lang.String message)
           
ProviderException(java.lang.String message, java.lang.Throwable cause)
           
ProviderException(java.lang.Throwable cause)
           
 
Method Summary
 ProviderException addErrorCode(java.lang.String errorCode)
          Adds error code to this exception.
 java.util.Set<java.lang.String> getErrorCodes()
          Returns error codes attached to this exception.
 java.lang.String getErrorStatement()
          Returns a statement for this error if any.
 java.lang.Throwable getNativeException()
          This method should be overriden by providers relying on external APIs to work with connections.
abstract  java.lang.String getProviderName()
          Overriden by subclasses to provide user friendly provider name.
protected  ProviderException setErrorStatement(java.lang.String errStmt)
          Sets problem statement which caused this exception/
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProviderException

public ProviderException()

ProviderException

public ProviderException(java.lang.String message)

ProviderException

public ProviderException(java.lang.String message,
                         java.lang.Throwable cause)

ProviderException

public ProviderException(java.lang.Throwable cause)
Method Detail

getErrorCodes

public java.util.Set<java.lang.String> getErrorCodes()
Returns error codes attached to this exception. For example JDBC drivers reports 2 error codes: SQLSTATE and vendor code.

Do not use ", . ;" in error codes.

Returns:
set of error codes.

addErrorCode

public ProviderException addErrorCode(java.lang.String errorCode)
Adds error code to this exception.

Parameters:
errorCode - vendor specific error code.
Returns:
this exception for convenience.

setErrorStatement

protected ProviderException setErrorStatement(java.lang.String errStmt)
Sets problem statement which caused this exception/

Parameters:
errStmt - statement text.
Returns:
this exception for convenience.

getNativeException

public java.lang.Throwable getNativeException()
This method should be overriden by providers relying on external APIs to work with connections. Used only for informative error reporting.

Examples: SQL Exceptions, LDAP connection exceptions etc.

Returns:
external API throwable wich may be important for user to recognize the problem.

getErrorStatement

public java.lang.String getErrorStatement()
Returns a statement for this error if any.

Returns:
statement text and additional data.

getProviderName

public abstract java.lang.String getProviderName()
Overriden by subclasses to provide user friendly provider name.

Returns:
provider name.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Throwable


Copyright © Copyright 2006-2009 The Scriptella Project Team.