32 #ifndef _QORE_EXCEPTIONSINK_H 34 #define _QORE_EXCEPTIONSINK_H 43 struct QoreProgramLocation;
48 friend struct qore_es_private;
52 struct qore_es_private *priv;
89 DLLEXPORT
operator bool ()
const;
177 DLLEXPORT
void clear();
192 DLLLOCAL QoreException* catchException();
193 DLLLOCAL QoreException* getException();
194 DLLLOCAL
void overrideLocation(
const QoreProgramLocation& loc);
195 DLLLOCAL
void rethrow(QoreException* old);
197 DLLLOCAL
static void defaultExceptionHandler(QoreException* e);
198 DLLLOCAL
static void defaultWarningHandler(QoreException* e);
221 DLLLOCAL
QoreSourceLocation(
const char* n_label,
int start,
int end,
const char* n_code) :
225 DLLLOCAL
QoreSourceLocation(
const char* n_label,
int start,
int end,
const char* n_source,
unsigned n_offset,
const char* n_code) :
237 DLLLOCAL
QoreCallStackElement(qore_call_t n_type,
const char* n_label,
int start,
int end,
const char* n_code) :
241 DLLLOCAL
QoreCallStackElement(qore_call_t n_type,
const char* n_label,
int start,
int end,
const char* n_source,
unsigned n_offset,
const char* n_code) :
246 typedef std::vector<QoreCallStackElement> callstack_vec_t;
252 DLLLOCAL
void add(qore_call_t n_type,
const char* n_label,
int start,
int end,
const char* n_code) {
256 DLLLOCAL
void add(qore_call_t n_type,
const char* n_label,
int start,
int end,
const char* n_source,
unsigned n_offset,
const char* n_code) {
261 static inline void alreadyDeleted(
ExceptionSink *xsink,
const char *cmeth) {
262 xsink->
raiseException(
"OBJECT-ALREADY-DELETED",
"the method %s() cannot be executed because the object has already been deleted", cmeth);
265 static inline void makeAccessDeletedObjectException(
ExceptionSink *xsink,
const char *mem,
const char *cname) {
266 xsink->
raiseException(
"OBJECT-ALREADY-DELETED",
"attempt to access member '%s' of an already-deleted object of class '%s'", mem, cname);
269 static inline void makeAccessDeletedObjectException(
ExceptionSink *xsink,
const char *cname) {
270 xsink->
raiseException(
"OBJECT-ALREADY-DELETED",
"attempt to access an already-deleted object of class '%s'", cname);
DLLEXPORT void handleWarnings()
calls ExceptionSink::defaultWarningHandler() on all exceptions still present in the object and then d...
unsigned offset
offset in source file (only used if source is not empty)
Definition: ExceptionSink.h:218
DLLEXPORT void outOfMemory()
intended to be used to handle out of memory errors FIXME: not yet fully implemented ...
DLLEXPORT ~ExceptionSink()
calls ExceptionSink::defaultExceptionHandler() on all exceptions still present in the object and then...
DLLEXPORT void handleExceptions()
calls ExceptionSink::defaultExceptionHandler() on all exceptions still present in the object and then...
The base class for all value and parse types in Qore expression trees.
Definition: AbstractQoreNode.h:54
std::string label
the code label name (source file if source not present)
Definition: ExceptionSink.h:214
DLLEXPORT AbstractQoreNode * raiseException(const char *err, const char *fmt,...)
appends a Qore-language exception to the list
DLLEXPORT AbstractQoreNode * raiseErrnoException(const char *err, int en, const char *fmt,...)
appends a Qore-language exception to the list and appends the result of strerror(errno) to the descri...
Qore's string value type, reference counted, dynamically-allocated only.
Definition: QoreStringNode.h:50
DLLEXPORT const AbstractQoreNode * getExceptionArg()
returns the argument of the top exception
This is the list container type in Qore, dynamically allocated only, reference counted.
Definition: QoreListNode.h:52
std::string code
the function or method call name; method calls in format class::name
Definition: ExceptionSink.h:219
DLLEXPORT const AbstractQoreNode * getExceptionErr()
returns the error of the top exception
DLLEXPORT AbstractQoreNode * raiseExceptionArg(const char *err, AbstractQoreNode *arg, const char *fmt,...)
appends a Qore-language exception to the list, and sets the 'arg' member (this object takes over the ...
DLLEXPORT void clear()
deletes the exception list immediately
int start_line
the start line
Definition: ExceptionSink.h:215
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:47
DLLEXPORT const AbstractQoreNode * getExceptionDesc()
returns the description of the top exception
qore_call_t type
the call stack element type
Definition: ExceptionSink.h:235
int end_line
the end line
Definition: ExceptionSink.h:215
DLLEXPORT bool isThreadExit() const
returns true if thread_exit has been triggered
DLLEXPORT void raiseThreadExit()
sets the "thread_exit" flag; will cause the current thread to terminate
DLLEXPORT ExceptionSink()
creates an empty ExceptionSink object
Qore source location; strings must be in the default encoding for the Qore process.
Definition: ExceptionSink.h:213
std::string source
optional additional source file
Definition: ExceptionSink.h:217
DLLEXPORT bool isException() const
returns true if at least one exception is present
Qore call stack.
Definition: ExceptionSink.h:251
DLLEXPORT void assimilate(ExceptionSink *xs)
assimilates all entries of the "xs" argument by appending them to the internal list and deletes the "...
DLLEXPORT bool isEvent() const
returns true if at least one exception is present or thread_exit has been triggered ...
call stack element; strings must be in the default encoding for the Qore process
Definition: ExceptionSink.h:234