Overview
Class List
Class Hierarchy
Class Members
Functions & Constants
Defines
Header Files
exceptions.hpp File Reference
Detailed Description
. This file contains the base class for all exceptions used in UIMACPP.
DESCRIPTION: Declaration of the classes: ErrorMessage ExceptionDescription Exception AccessError AssertionFailure DeviceError InvalidParameter InvalidRequest ResourceExhausted OutOfMemory OutOfSystemResource OutOfWindowResource
This file also contains many of the macros used to implement the library exception handling mechanism. This includes the UIMA_ASSERT, UIMA_EXC_THROW, UIMA_EXC_RETHROW, UIMA_EXC_CONTEXT, UIMA_EXCEPTION_DESCRIPTION, UIMA_EXC_CLASSDECLARE, UIMA_EXC_CLASSIMPLEMENT, macros.
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
This file contains the base class for all exceptions used in UIMACPP project. The design goal was to allow for an easy way to provide rich context information with the exception without introducing the need to write lots of lines of code every time you use an exception.
The way this is accomplished here is by defining a rich exception class and then providing macros for its everyday use that hide its complexity and automate a lot of processes.
A UIMACPP exception has an error info object as its main informational member. Such an error info object containes a text, which is supposed to be a simple description of the error with out context (e.g. "Could not open file") an error number and an error severity (recoverable or unrecoverable). To this basic information a list of error contexts can be added (a context has a text and a location, see class ErrorContext
above). A context specifies what the program was trying to do, when the error occurred (e.g. "Trying to open file XYZ.ABC for reading") since very often not the whole context a user might need to understand the error is locally available the exception can be re-throw after adding a context. At the point where it is caught more context can be added and again it can be re-thrown until finally the exception can be taken care of (examined/displayed).
This process of defining/catching, adding context and then (re)throwing is what is very convenient to do via the macros defined below.
Include dependency graph for exceptions.hpp:
This graph shows which files directly or indirectly include this file:
|
Defines |
#define | UIMA_MSG_MAX_STR_LEN 4096 |
#define | UIMA_MSG_REPLACE_CHAR '%' |
#define | EXCEPTION_BASE_CLASS std::exception |
#define | UIMA_EXC_CONTEXT(cntxt) uima::ErrorContext((uima::ErrorMessage)(cntxt), __FILE__, 0, __LINE__) |
#define | UIMA_EXC_ADD_CONTEXT(exc, cntxt) exc.getErrorInfo().addContext(UIMA_EXC_CONTEXT((ErrorMessage)(cntxt))) |
#define | UIMA_EXC_THROW(exc, cntxt) |
#define | UIMA_EXC_RETHROW(exc, cntxt) |
#define | UIMA_EXC_THROW_NEW(exType, errorNbr, errorMsg, exContext, recoverable) |
#define | UIMA_EXC_ASSERT_EXCEPTION(test) |
#define | CHILD_DESTRUCT_THROW0() UIMA_THROW0() |
#define | UIMA_EXC_CLASSDECLARE(child, parent) |
#define | UIMA_EXC_CLASSIMPLEMENT(child, parent) |
Define Documentation
#define UIMA_MSG_MAX_STR_LEN 4096 |
|
#define UIMA_MSG_REPLACE_CHAR '%' |
|
#define EXCEPTION_BASE_CLASS std::exception |
|
#define UIMA_EXC_CONTEXT |
( |
cntxt |
|
) |
uima::ErrorContext((uima::ErrorMessage)(cntxt), __FILE__, 0, __LINE__) |
|
#define UIMA_EXC_ADD_CONTEXT |
( |
exc, |
|
|
cntxt |
|
) |
exc.getErrorInfo().addContext(UIMA_EXC_CONTEXT((ErrorMessage)(cntxt))) |
|
#define UIMA_EXC_THROW |
( |
exc, |
|
|
cntxt |
|
) |
|
|
|
Value: exc.getErrorInfo().addContext(UIMA_EXC_CONTEXT(cntxt)),\
exc.logExceptionData(),\
throw(exc)
|
#define UIMA_EXC_RETHROW |
( |
exc, |
|
|
cntxt |
|
) |
|
|
|
Value: exc.getErrorInfo().addContext(UIMA_EXC_CONTEXT(cntxt)),\
exc.logExceptionData(),\
throw exc
|
#define UIMA_EXC_THROW_NEW |
( |
exType, |
|
|
errorNbr, |
|
|
errorMsg, |
|
|
exContext, |
|
|
recoverable |
|
) |
|
|
|
Value: exType exc(errorMsg, errorNbr, recoverable); \
UIMA_EXC_THROW(exc, exContext)
|
#define UIMA_EXC_ASSERT_EXCEPTION |
( |
test |
|
) |
|
|
#define CHILD_DESTRUCT_THROW0 |
( |
|
) |
UIMA_THROW0() |
|
#define UIMA_EXC_CLASSDECLARE |
( |
child, |
|
|
parent |
|
) |
|
|
|
Value: \
class UIMA_LINK_IMPORTSPEC child : public parent { \
public: \
child ( \
uima::ErrorMessage clMessage, \
uima::TyErrorId ulErrorId, \
uima::ErrorInfo::EnSeverity enSeverity = uima::ErrorInfo::unrecoverable \
); \
child ( \
uima::ErrorInfo clErrInfo \
); \
virtual const char* getName() const; \
virtual ~child() CHILD_DESTRUCT_THROW0(); \
child (const child &); \
private: \
child &operator = ( const child & ); \
}
|
#define UIMA_EXC_CLASSIMPLEMENT |
( |
child, |
|
|
parent |
|
) |
|
|
|
Value: \
child :: child ( \
uima::ErrorMessage clMessage, \
uima::TyErrorId ulErrorId, \
uima::ErrorInfo::EnSeverity enSeverity \
) \
: parent (clMessage, ulErrorId, enSeverity) \
{;} \
child :: child ( \
uima::ErrorInfo clInfo \
) \
: parent (clInfo) \
{;} \
const char* child :: getName() const { \
return ( # child); \
} \
child :: ~ child () CHILD_DESTRUCT_THROW0() {;} \
child::child (const child & a) : parent (a) {;} \
|
Generated on Fri Aug 22 17:31:26 2008 for UIMACPP API by
1.3.9.1