ErrorMgr.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2005 Palmsource, Inc.
00003  * 
00004  * This software is licensed as described in the file LICENSE, which
00005  * you should have received as part of this distribution. The terms
00006  * are also available at http://www.openbinder.org/license.html.
00007  * 
00008  * This software consists of voluntary contributions made by many
00009  * individuals. For the exact contribution history, see the revision
00010  * history and logs, available at http://www.openbinder.org
00011  */
00012 
00019 #ifndef _ERRORMGR_H_
00020 #define _ERRORMGR_H_
00021 
00022 #include <PalmTypes.h>
00023 
00024 #ifdef __cplusplus
00025 extern "C" {
00026 #endif
00027 
00028 //---------------------------------------------------------------------------------------
00029 // You probably don't want to use this function unless you want show a different
00030 //  file name and line number.
00031 void ErrFatalErrorInContext(const char* fileName, uint32_t lineNum, const char* msg);
00032 
00033 #ifdef __cplusplus
00034 }
00035 #endif
00036 
00037 //---------------------------------------------------------------------------------------
00038 // ErrFatalError and ErrFatalErrorIf will always compiled in.
00039 #define ErrFatalError(msg)              ErrFatalErrorInContext(MODULE_NAME, __LINE__, msg)
00040 #define ErrFatalErrorIf(condition, msg) ((condition) ? ErrFatalError(msg) : (void)0)
00041 
00042 //---------------------------------------------------------------------------------------
00043 // DbgOnlyFatalError and DbgOnlyFatalErrorIf will only be compiled in on Debug builds.
00044 #if BUILD_TYPE != BUILD_TYPE_RELEASE
00045 #   define DbgOnlyFatalError(msg)                   ErrFatalError(msg)
00046 #   define DbgOnlyFatalErrorIf(condition, msg)      ErrFatalErrorIf(condition, msg)
00047 #else
00048 #   define DbgOnlyFatalError(msg)                   /* NOP */
00049 #   define DbgOnlyFatalErrorIf(condition, msg)      /* NOP */
00050 #endif
00051 
00052 #endif // _ERRORMGR_H_