org.ceryle.wiki.plugin.query
Class QueryException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by org.ceryle.wiki.plugin.query.QueryException
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
AssertionException

public class QueryException
extends Exception

A simple typed exception for use by the QueryPlugin. Permitted types include QUERY_ERROR, SYNTAX_ERROR, and GRAMMAR_ERROR.

Author:
Murray Altheim, John Volkar (john.volkar at gmail.com)
See Also:
Serialized Form

Field Summary
static int GRAMMAR_ERROR
          An exception type constant indicating a query exception due to an expression grammatical error.
protected static int m_type
           
static int PARAMETER_ERROR
          An exception type constant indicating an error in plugin or parameter syntax.
static int QUERY_ERROR
          An exception type constant indicating a general (untyped or unspecified) query exception.
static int SYNTAX_ERROR
          An exception type constant indicating a query exception due to an expression syntax error.
static int UNKNOWN_ERROR
          An exception type constant indicating an unknown error condition.
 
Constructor Summary
QueryException()
          Default constructor.
QueryException(int type)
          Constructor for a QueryException with a type and no message.
QueryException(int type, String message)
          Constructor for typed query exception, provided the type and message.
QueryException(int type, String message, Throwable original)
          Tunnel an existing Throwable original with the provided type and message.
QueryException(String message)
          Constructor for a general (untyped or unspecified) query exception with the provided message.
QueryException(String message, Throwable original)
          Tunnel an existing Throwable original with the provided message.
 
Method Summary
 int getType()
          Returns the type of this QueryException.
 String getTypeDescription()
          Return a textual description of the exception type, suitable as an exception "title".
static String getTypeDescription(int type, Throwable throwable)
          Return a textual description of the exception type, suitable as an exception "title".
protected  void setType(int type)
          Sets the type of this QueryException.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNKNOWN_ERROR

public static final int UNKNOWN_ERROR
An exception type constant indicating an unknown error condition.

See Also:
Constant Field Values

PARAMETER_ERROR

public static final int PARAMETER_ERROR
An exception type constant indicating an error in plugin or parameter syntax.

See Also:
Constant Field Values

QUERY_ERROR

public static final int QUERY_ERROR
An exception type constant indicating a general (untyped or unspecified) query exception.

See Also:
Constant Field Values

SYNTAX_ERROR

public static final int SYNTAX_ERROR
An exception type constant indicating a query exception due to an expression syntax error.

See Also:
Constant Field Values

GRAMMAR_ERROR

public static final int GRAMMAR_ERROR
An exception type constant indicating a query exception due to an expression grammatical error.

See Also:
Constant Field Values

m_type

protected static int m_type
Constructor Detail

QueryException

public QueryException()
Default constructor.


QueryException

public QueryException(int type)
Constructor for a QueryException with a type and no message. The unlocalized message will be set to the value provided from getTypeDescription().


QueryException

public QueryException(String message)
Constructor for a general (untyped or unspecified) query exception with the provided message.


QueryException

public QueryException(int type,
                      String message)
Constructor for typed query exception, provided the type and message.


QueryException

public QueryException(String message,
                      Throwable original)
Tunnel an existing Throwable original with the provided message.


QueryException

public QueryException(int type,
                      String message,
                      Throwable original)
Tunnel an existing Throwable original with the provided type and message.

Method Detail

setType

protected void setType(int type)
Sets the type of this QueryException.


getType

public int getType()
Returns the type of this QueryException.

See Also:
PARAMETER_ERROR, QUERY_ERROR, SYNTAX_ERROR, GRAMMAR_ERROR

getTypeDescription

public String getTypeDescription()
Return a textual description of the exception type, suitable as an exception "title". This is localized only for English. For other localizations, use the int type values.

See Also:
getTypeDescription(int,Throwable)

getTypeDescription

public static String getTypeDescription(int type,
                                        Throwable throwable)
Return a textual description of the exception type, suitable as an exception "title". This is localized only for English. For other localizations, use the page name and int type values. The optional throwable is used only for untyped/unknown exceptions to indicate the Exception class.

Parameters:
type - the type of the description
throwable - an optional Throwable (e.g., Exception)
See Also:
PARAMETER_ERROR, QUERY_ERROR, SYNTAX_ERROR, GRAMMAR_ERROR


The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.