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/config.h>
00020 #include <zorba/exception.h>
00021 
00022 namespace zorba {
00023 
00024   /** \brief ErrorHandler defines an interface. Classes that implement this interface
00025    *         can be used as callback classes.
00026    *
00027    * Specifically, they can be registered with an XQuery object. This way, all 
00028    * errors that would have been reported by throwing an exception are reported 
00029    * by calling the according function of this interface. Subclasses of the 
00030    * ZorbaException class that would have been thrown are passed as parameter
00031    * to the callback function.
00032    */
00033   class ZORBA_EXTERN_DECL ErrorHandler 
00034   {
00035     public:
00036       /** \brief Destructor
00037        *
00038        */
00039       virtual ~ErrorHandler() {}
00040 
00041       /** \brief Callback function that is called for static errors 
00042        *         as defined in the XQuery 1.0 Specification 
00043        *         (see http://www.w3.org/TR/xquery/#id-kinds-of-errors 
00044        *
00045        * @param aStaticError information about the error.
00046        */
00047       virtual void
00048       staticError ( const StaticException& aStaticError ) = 0;
00049 
00050       /** \brief Callback function that is called for dynamic errors 
00051        *         as defined in the XQuery 1.0 Specification 
00052        *         (see http://www.w3.org/TR/xquery/#id-kinds-of-errors 
00053        *
00054        * @param aDynamicError information about the error.
00055        */
00056       virtual void
00057       dynamicError ( const DynamicException& aDynamicError ) = 0;
00058 
00059       /** \brief Callback function that is called for type errors 
00060        *         as defined in the XQuery 1.0 Specification 
00061        *         (see http://www.w3.org/TR/xquery/#id-kinds-of-errors 
00062        *
00063        * @param aTypeError information about the error.
00064        */
00065       virtual void
00066       typeError ( const TypeException& aTypeError ) = 0;
00067 
00068       /** \brief Callback function that is called for errors that occur during
00069        *         serialization of a query result.
00070        *         (see http://www.w3.org/TR/2005/CR-xslt-xquery-serialization-20051103/)
00071        *
00072        * @param aSerializationError information about the error.
00073        */
00074       virtual void
00075       serializationError ( const  SerializationException& aSerializationError ) = 0;
00076 
00077       /** \brief Callback function that is called for errors that occur in the system.
00078        *
00079        * @param aSystemError information about the error.
00080        */
00081       virtual void
00082       systemError ( const SystemException& aSystemError ) = 0;
00083    };
00084 
00085 } /* namespace zorba */
00086 
00087 #endif