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
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
DuplError(const String &str, Category c=BOUNDARY)
String getStackTrace() const
AipsError(const Char *str, Category c=GENERAL)
Creates an AipsError and initializes the error message from the parameter.
int error() const
Get the errno.
DuplError(const Char *str, Category c=BOUNDARY)
static void throwIf(Bool condition, const String &message, const char *file, Int line, const char *func="")
Throw if the condition is true.
DuplError(Category c=BOUNDARY)
Creates an DuplError and initializes the error message from the parameter.
void setMessage(const String &msg) const
Append a message.
IndexError(Category c=BOUNDARY)
Initialization error, typically of static data shared between objects.
AllocError(const Char *str, uInt sze)
This constructor takes the error message and the failed allocation size.
indexError(t oI, Category c=BOUNDARY)
Index errors returning the bad index.
const String & getMesg() const
AllocError(const String &str, uInt sze)
static String getLastMessage()
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.
static void getLastInfo(String &message, String &stackTrace)
Get or clear the stacktrace info.
duplError(t oI, Category c=BOUNDARY)
IndexError(const Char *str, Category c=BOUNDARY)
Creates an GeneralIndexError and initializes the error message from the parameter.
Base class for all indexing errors.
void addStackTrace()
Add the stack trace to the message (if USE_STACKTRACE is set).
const Char * c_str() const
Get char array.
AipsError::Category getCategory() const
bool Bool
Define the standard types used by Casacore.
static String getLastStackTrace()
virtual const char * what() const noexcept
Simply returns the stored error message.
Exception which halts execution.
~AipsError() noexcept
Destructor which does nothing.
size_t size() const
This function returns the failed allocation size.
IndexError(const String &str, Category c=BOUNDARY)
Base class for all Casacore library errors.
static void clearLastInfo()
const Double c
Fundamental physical constants (SI units):
String: the storage and methods of handling collections of characters.
Duplicate key errors where the bad key is returned.
static AipsError repackageAipsError(AipsError &error, const String &message, const char *file, Int line, const char *func)
Repackage an exception.
Exception for an error in a system call.
Defines nreal time structures used by the VLA table filler.
#define casacore
<X11/Intrinsic.h> #defines true, false, casacore::Bool, and String.