1 #ifndef CARMA_UTIL_ERROR_EXCEPTION_H
2 #define CARMA_UTIL_ERROR_EXCEPTION_H
41 #include <log4cpp/Priority.hh>
64 ErrorException(
const std::string& msg,
const char* filename,
int lineNo);
79 const char* filename,
int lineNo);
101 virtual const char*
what()
const throw();
104 virtual ::std::string getLogString( )
const;
118 void log(log4cpp::Priority::PriorityLevel priority)
const;
135 void buildErrorMsg(
const char * filename );
137 const char * errorMsg_;
163 ::std::ostream &
operator<<( ::std::ostream & os,
164 const ::std::exception & error );
171 #define CARMA_ERROR(y) CARMA_EXCEPTION(carma::util::ErrorException,(y))
175 #define ThrowCarmaError(text) \
177 std::ostringstream _macroOs; \
179 throw CARMA_ERROR(_macroOs.str());\
182 #define ThrowCarmaUserException(text) \
184 std::ostringstream _macroOs; \
186 throw CARMA_EXCEPTION( carma::util::UserException, _macroOs.str().c_str() );\
189 #define CARMA_ASSERT( assertion ) \
191 if ( !(assertion) ) \
192 throw CARMA_ERROR( #assertion ); \
198 #define ThrowCarmaException(exception, text) \
200 std::ostringstream _macroOs; \
202 throw CARMA_EXCEPTION( exception, _macroOs.str() ); \
208 #define MAKE_DERIVED_ERROR_EXCEPTION(T) \
210 class T : public carma::util::ErrorException { \
213 T( const std::string & os, \
214 const char * filename, \
215 const int lineNumber) : \
216 carma::util::ErrorException( \
217 ( std::string )( #T ) + ": " + os, \
222 T( const std::ostringstream & os, \
223 const char * filename, \
224 const int lineNumber) : \
225 carma::util::ErrorException( \
226 ( std::string )( #T ) + ": " + os.str(),\
231 virtual ~T() throw () \
236 #endif // CARMA_UTIL_ERROR_EXCEPTION_H
std::ostream & operator<<(::std::ostream &os, const carma::dbms::Table &table)
This is the include file for Carma exception handling utilities.
virtual const char * what() const
Get the error message; overrides BaseException & std::exception.what()
Base exception class for managing carma errors.
void log(log4cpp::Priority::PriorityLevel priority) const
Log the exception.
std::string getErrorMessage() const
Get the full error message, including line number and file name.
virtual ~ErrorException()
Destructor.
Exception class for errors The exception comes with a text string that can be printed or logged...
void report() const
Report error to standard err.
ErrorException()
Default constructor.