Go to the documentation of this file.
32 #include <casacore/casa/aips.h>
33 #include <casacore/casa/BasicSL/String.h>
35 #include <sys/types.h>
45 #define CASATHROW(exc, arg) do { \
46 std::ostringstream casa_log_oss; \
47 casa_log_oss << arg; \
48 throw exc(casa_log_oss.str()); \
55 #define AssertCc(c) ((void)0)
57 #define AssertCc(c) { if (AIPS_UNLIKELY(! (c))) {casacore::AipsError::throwIf (casacore::True, "Assertion failed: " #c, __FILE__, __LINE__, __PRETTY_FUNCTION__); }}
60 #define AssertAlways(c) { if (AIPS_UNLIKELY(! (c))) {casacore::AipsError::throwIf (casacore::True, "Assertion failed: " #c, __FILE__, __LINE__, __PRETTY_FUNCTION__); }}
64 LogIO os(LogOrigin("", __func__, __LINE__, WHERE));\
65 os << LogIO::WARN << m << LogIO::POST;\
71 #define AssertOrWarn(c,m) ((void)0)
73 #define AssertOrWarn(c,m)\
74 { if (AIPS_UNLIKELY(! (c))) {\
82 { casacore::AipsError anAipsError ((m), __FILE__, __LINE__); \
85 # define ThrowCc(m) throw casacore::AipsError ((m), __FILE__, __LINE__)
89 #define ThrowIf(c,m) {if (AIPS_UNLIKELY(c)) {casacore::AipsError::throwIf (casacore::True, (m), __FILE__, __LINE__, __PRETTY_FUNCTION__);}}
93 #define ThrowIfError(c,m) {if (AIPS_UNLIKELY(c)) {casacore::AipsError::throwIfError (casacore::True, (m), __FILE__, __LINE__, __PRETTY_FUNCTION__);}}
96 #define Rethrow(e,m) {throw casacore::AipsError::repackageAipsError ((e),(m),__FILE__,__LINE__, __PRETTY_FUNCTION__);}
146 virtual const char*
what() const noexcept
157 { const_cast<AipsError*>(
this)->message = msg; }
191 const
char* file,
Int line,
192 const
char* func = "");
196 const
char* file,
Int line,
197 const
char* func = "");
248 size_t size()
const {
return(Size);}
452 static String errorMessage(
int error);
516 #ifdef AIPS_NEEDS_RETHROW
517 #ifndef CASACORE_NEEDS_RETHROW
518 #define CASACORE_NEEDS_RETHROW
522 #ifdef CASACORE_NEEDS_RETHROW
523 #define RETHROW(X) throw(X);
528 #ifndef CASACORE_NO_AUTO_TEMPLATES
529 #include <casacore/casa/Exceptions/Error.tcc>
530 #endif //# CASACORE_NO_AUTO_TEMPLATES
static void throwIfError(Int errorCode, const String &prefix, const char *file, Int line, const char *func="")
Throw if the system error code is not 0.
Exception for an error in a system call.
Exception which halts execution.
Index errors returning the bad index.
const Char * c_str() const
Get char array.
virtual const char * what() const noexcept
Simply returns the stored error message.
duplError(t oI, Category c=BOUNDARY)
const String & getMesg() const
IndexError(const String &str, Category c=BOUNDARY)
static String getLastMessage()
DuplError(const String &str, Category c=BOUNDARY)
static void clearLastInfo()
int error() const
Get the errno.
~AipsError() noexcept
Destructor which does nothing.
Initialization error, typically of static data shared between objects.
void setMessage(const String &msg) const
Append a message.
static AipsError repackageAipsError(AipsError &error, const String &message, const char *file, Int line, const char *func)
Repackage an exception.
this file contains all the compiler specific defines
AipsError(const Char *str, Category c=GENERAL)
Creates an AipsError and initializes the error message from the parameter.
String getStackTrace() const
static void throwIf(Bool condition, const String &message, const char *file, Int line, const char *func="")
Throw if the condition is true.
const Double c
Fundamental physical constants (SI units):
IndexError(Category c=BOUNDARY)
static String getLastStackTrace()
static void getLastInfo(String &message, String &stackTrace)
Get or clear the stacktrace info.
indexError(t oI, Category c=BOUNDARY)
void addStackTrace()
Add the stack trace to the message (if USE_STACKTRACE is set).
String: the storage and methods of handling collections of characters.
bool Bool
Define the standard types used by Casacore.
AllocError(const String &str, uInt sze)
DuplError(Category c=BOUNDARY)
Creates an DuplError and initializes the error message from the parameter.
DuplError(const Char *str, Category c=BOUNDARY)
AllocError(const Char *str, uInt sze)
This constructor takes the error message and the failed allocation size.
AipsError::Category getCategory() const
Duplicate key errors where the bad key is returned.
Base class for all Casacore library errors.
size_t size() const
This function returns the failed allocation size.
Base class for all indexing errors.
IndexError(const Char *str, Category c=BOUNDARY)
Creates an GeneralIndexError and initializes the error message from the parameter.