error_handler.h

Go to the documentation of this file.
00001 /*
00002  * Copyright 2006-2008 The FLWOR Foundation.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  * 
00008  * http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 #ifndef ZORBA_ERROR_HANDLER_API_H
00017 #define ZORBA_ERROR_HANDLER_API_H
00018 
00019 #include <zorba/exception.h>
00020 
00021 namespace zorba {
00022 
00023   /** \brief ErrorHandler defines an interface. Classes that implement this interface
00024    *         can be used as callback classes.
00025    *
00026    * Specifically, they can be registered with an XQuery object. This way, all 
00027    * errors that would have been reported by throwing an exception are reported 
00028    * by calling the according function of this interface. Subclasses of the ZorbaException class
00029    * that would have been thrown are passed as parameter to the callback function.
00030    */
00031   class ErrorHandler 
00032   {
00033     public:
00034       /** \brief Destructor
00035        *
00036        */
00037       virtual ~ErrorHandler() {}
00038 
00039       /** \brief Callback function that is called for static errors 
00040        *         as defined in the XQuery 1.0 Specification 
00041        *         (see http://www.w3.org/TR/xquery/#id-kinds-of-errors 
00042        *
00043        * @param aStaticError information about the error.
00044        */
00045       virtual void
00046       staticError ( const StaticException& aStaticError ) = 0;
00047 
00048       /** \brief Callback function that is called for dynamic errors 
00049        *         as defined in the XQuery 1.0 Specification 
00050        *         (see http://www.w3.org/TR/xquery/#id-kinds-of-errors 
00051        *
00052        * @param aDynamicError information about the error.
00053        */
00054       virtual void
00055       dynamicError ( const DynamicException& aDynamicError ) = 0;
00056 
00057       /** \brief Callback function that is called for type errors 
00058        *         as defined in the XQuery 1.0 Specification 
00059        *         (see http://www.w3.org/TR/xquery/#id-kinds-of-errors 
00060        *
00061        * @param aTypeError information about the error.
00062        */
00063       virtual void
00064       typeError ( const TypeException& aTypeError ) = 0;
00065 
00066       /** \brief Callback function that is called for errors that occur during
00067        *         serialization of a query result.
00068        *         (see http://www.w3.org/TR/2005/CR-xslt-xquery-serialization-20051103/)
00069        *
00070        * @param aSerializationError information about the error.
00071        */
00072       virtual void
00073       serializationError ( const  SerializationException& aSerializationError ) = 0;
00074 
00075       /** \brief Callback function that is called for errors that occur in the system.
00076        *
00077        * @param aSystemError information about the error.
00078        */
00079       virtual void
00080       systemError ( const SystemException& aSystemError ) = 0;
00081    };
00082 
00083 } /* namespace zorba */
00084 
00085 #endif