Qore Programming Language  0.9.16
ExceptionSink Class Reference

container for holding Qore-language exception information and also for registering a "thread_exit" call More...

#include <ExceptionSink.h>

Public Member Methods

DLLEXPORT ExceptionSink ()
 creates an empty ExceptionSink object
 
DLLEXPORT ~ExceptionSink ()
 calls ExceptionSink::defaultExceptionHandler() on all exceptions still present in the object and then deletes the exception list
 
DLLEXPORT int appendLastDescription (const char *fmt,...)
 appends a formatted string to the top exception description if the desc value is a string More...
 
DLLEXPORT void assimilate (ExceptionSink &xs)
 assimilates all entries of the "xs" argument by appending them to the internal list and clears the "xs" argument
 
DLLEXPORT void assimilate (ExceptionSink *xs)
 assimilates all entries of the "xs" argument by appending them to the internal list and deletes the "xs" argument
 
DLLEXPORT void clear ()
 deletes the exception list immediately
 
const DLLEXPORT QoreValue getExceptionArg ()
 returns the argument of the top exception
 
const DLLEXPORT QoreValue getExceptionDesc ()
 returns the description of the top exception
 
const DLLEXPORT QoreValue getExceptionErr ()
 returns the error of the top exception
 
DLLEXPORT void handleExceptions ()
 calls ExceptionSink::defaultExceptionHandler() on all exceptions still present in the object and then deletes the exception list
 
DLLEXPORT void handleWarnings ()
 calls ExceptionSink::defaultWarningHandler() on all exceptions still present in the object and then deletes the exception list
 
DLLEXPORT bool isEvent () const
 returns true if at least one exception is present or thread_exit has been triggered
 
DLLEXPORT bool isException () const
 returns true if at least one exception is present
 
DLLEXPORT bool isThreadExit () const
 returns true if thread_exit has been triggered
 
DLLEXPORT operator bool () const
 returns true if at least one exception is present or thread_exit has been triggered More...
 
DLLEXPORT void outOfMemory ()
 intended to be used to handle out of memory errors FIXME: not yet fully implemented
 
DLLEXPORT AbstractQoreNoderaiseErrnoException (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 description More...
 
DLLEXPORT AbstractQoreNoderaiseErrnoException (const char *err, int en, QoreStringNode *desc)
 appends a Qore-language exception to the list and appends the result of strerror(errno) to the description More...
 
DLLEXPORT AbstractQoreNoderaiseException (const char *err, const char *fmt,...)
 appends a Qore-language exception to the list More...
 
DLLEXPORT AbstractQoreNoderaiseException (const char *err, QoreStringNode *desc)
 appends a Qore-language exception to the list; takes owenership of the "desc" argument reference More...
 
DLLEXPORT void raiseException (const QoreProgramLocation &loc, const char *err, QoreValue arg, const char *fmt,...)
 appends a Qore-language exception to the list; takes owenership of the "desc" argument reference More...
 
DLLEXPORT void raiseException (const QoreProgramLocation &loc, const char *err, QoreValue arg, QoreValue desc)
 appends a Qore-language exception to the list; takes owenership of the "desc" argument reference More...
 
DLLEXPORT AbstractQoreNoderaiseException (QoreStringNode *err, QoreStringNode *desc)
 appends a Qore-language exception to the list; takes owenership of the "desc" argument reference More...
 
DLLEXPORT AbstractQoreNoderaiseException (QoreStringNode *err, QoreStringNode *desc, QoreValue arg)
 appends a Qore-language exception to the list; takes owenership of the "desc" argument reference More...
 
DLLEXPORT AbstractQoreNoderaiseExceptionArg (const char *err, QoreValue arg, const char *fmt,...)
 appends a Qore-language exception to the list, and sets the 'arg' member (this object takes over the reference count of 'arg') More...
 
DLLEXPORT AbstractQoreNoderaiseExceptionArg (const char *err, QoreValue arg, QoreStringNode *desc)
 appends a Qore-language exception to the list, and sets the 'arg' member (this object takes over the reference counts of 'arg' and 'desc') More...
 
DLLEXPORT AbstractQoreNoderaiseExceptionArg (const char *err, QoreValue arg, QoreStringNode *desc, const QoreCallStack &stack)
 appends a Qore-language exception to the list, and sets the 'arg' member (this object takes over the reference counts of 'arg' and 'desc') More...
 
DLLEXPORT AbstractQoreNoderaiseExceptionArg (const QoreProgramLocation &loc, const char *err, QoreValue arg, QoreStringNode *desc)
 appends a Qore-language exception to the list, and sets the 'arg' member (this object takes over the reference counts of 'arg' and 'desc') More...
 
DLLEXPORT AbstractQoreNoderaiseExceptionArg (const QoreProgramLocation &loc, const char *err, QoreValue arg, QoreStringNode *desc, const QoreCallStack &stack)
 appends a Qore-language exception to the list, and sets the 'arg' member (this object takes over the reference counts of 'arg' and 'desc') More...
 
DLLEXPORT void raiseThreadExit ()
 sets the "thread_exit" flag; will cause the current thread to terminate
 

Detailed Description

container for holding Qore-language exception information and also for registering a "thread_exit" call

Member Function Documentation

◆ appendLastDescription()

DLLEXPORT int ExceptionSink::appendLastDescription ( const char *  fmt,
  ... 
)

appends a formatted string to the top exception description if the desc value is a string

Returns
-1 for error, not added, or 0 = OK
Since
Qore 0.9

◆ operator bool()

DLLEXPORT ExceptionSink::operator bool ( ) const

returns true if at least one exception is present or thread_exit has been triggered

Intended as a alternative to isEvent()

if (xsink) { .. }

◆ raiseErrnoException() [1/2]

DLLEXPORT AbstractQoreNode* ExceptionSink::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 description

The AbstractQoreNode pointer returned is always 0; used to simplify error handling code.

Parameters
errthe exception code string
enthe error number (normally "errno")
fmtthe format string for the description for the exception
Returns
always returns nullptr

◆ raiseErrnoException() [2/2]

DLLEXPORT AbstractQoreNode* ExceptionSink::raiseErrnoException ( const char *  err,
int  en,
QoreStringNode desc 
)

appends a Qore-language exception to the list and appends the result of strerror(errno) to the description

The AbstractQoreNode pointer returned is always 0; used to simplify error handling code.

Parameters
errthe exception code string
enthe error number (normally "errno")
descthe error description (the ExceptionSink object takes over ownership of the reference count)
Returns
always returns nullptr

◆ raiseException() [1/6]

DLLEXPORT AbstractQoreNode* ExceptionSink::raiseException ( const char *  err,
const char *  fmt,
  ... 
)

appends a Qore-language exception to the list

The AbstractQoreNode pointer returned is always 0; used to simplify error handling code.

Parameters
errthe exception code string
fmtthe format string for the description for the exception
Returns
always returns nullptr

Referenced by StreamReader::peekCheck().

◆ raiseException() [2/6]

DLLEXPORT AbstractQoreNode* ExceptionSink::raiseException ( const char *  err,
QoreStringNode desc 
)

appends a Qore-language exception to the list; takes owenership of the "desc" argument reference

The AbstractQoreNode pointer returned is always 0; used to simplify error handling code.

Parameters
errthe exception code string
descthe description string for the exception; the ExceptionSink object takes ownership of the reference count
Returns
always returns nullptr

◆ raiseException() [3/6]

DLLEXPORT void ExceptionSink::raiseException ( const QoreProgramLocation &  loc,
const char *  err,
QoreValue  arg,
const char *  fmt,
  ... 
)

appends a Qore-language exception to the list; takes owenership of the "desc" argument reference

Parameters
locthe source location for the exception
errthe exception code string for the exception
argthe 'arg' member of the Qore-language exception object; will be dereferenced when the QoreException object is destroyed
fmtthe format string for the description for the exception
Since
Qore 0.9.0

◆ raiseException() [4/6]

DLLEXPORT void ExceptionSink::raiseException ( const QoreProgramLocation &  loc,
const char *  err,
QoreValue  arg,
QoreValue  desc 
)

appends a Qore-language exception to the list; takes owenership of the "desc" argument reference

Parameters
locthe source location for the exception
errthe exception code string for the exception
argthe 'arg' member of the Qore-language exception object; will be dereferenced when the QoreException object is destroyed
descthe description string for the exception; the ExceptionSink object takes ownership of the reference count
Since
Qore 0.9.0

◆ raiseException() [5/6]

DLLEXPORT AbstractQoreNode* ExceptionSink::raiseException ( QoreStringNode err,
QoreStringNode desc 
)

appends a Qore-language exception to the list; takes owenership of the "desc" argument reference

The AbstractQoreNode pointer returned is always 0; used to simplify error handling code.

Parameters
errthe exception code string for the exception; the ExceptionSink object takes ownership of the reference count
descthe description string for the exception; the ExceptionSink object takes ownership of the reference count
Returns
always returns nullptr

◆ raiseException() [6/6]

DLLEXPORT AbstractQoreNode* ExceptionSink::raiseException ( QoreStringNode err,
QoreStringNode desc,
QoreValue  arg 
)

appends a Qore-language exception to the list; takes owenership of the "desc" argument reference

The AbstractQoreNode pointer returned is always 0; used to simplify error handling code.

Parameters
errthe exception code string for the exception; the ExceptionSink object takes ownership of the reference count
descthe description string for the exception; the ExceptionSink object takes ownership of the reference count
argthe exception argument
Returns
always returns nullptr
Since
Qore 0.9.5

◆ raiseExceptionArg() [1/5]

DLLEXPORT AbstractQoreNode* ExceptionSink::raiseExceptionArg ( const char *  err,
QoreValue  arg,
const char *  fmt,
  ... 
)

appends a Qore-language exception to the list, and sets the 'arg' member (this object takes over the reference count of 'arg')

The AbstractQoreNode pointer returned is always 0; used to simplify error handling code.

Parameters
errthe exception code string
argthe 'arg' member of the Qore-language exception object; will be dereferenced when the QoreException object is destroyed
fmtthe format string for the description for the exception
Returns
always returns nullptr

◆ raiseExceptionArg() [2/5]

DLLEXPORT AbstractQoreNode* ExceptionSink::raiseExceptionArg ( const char *  err,
QoreValue  arg,
QoreStringNode desc 
)

appends a Qore-language exception to the list, and sets the 'arg' member (this object takes over the reference counts of 'arg' and 'desc')

The AbstractQoreNode pointer returned is always 0; used to simplify error handling code.

Parameters
errthe exception code string
argthe 'arg' member of the Qore-language exception object; will be dereferenced when the QoreException object is destroyed
descthe description string for the exception; the ExceptionSink object takes ownership of the reference count
Returns
always returns nullptr

◆ raiseExceptionArg() [3/5]

DLLEXPORT AbstractQoreNode* ExceptionSink::raiseExceptionArg ( const char *  err,
QoreValue  arg,
QoreStringNode desc,
const QoreCallStack stack 
)

appends a Qore-language exception to the list, and sets the 'arg' member (this object takes over the reference counts of 'arg' and 'desc')

The AbstractQoreNode pointer returned is always 0; used to simplify error handling code.

Parameters
errthe exception code string
argthe 'arg' member of the Qore-language exception object; will be dereferenced when the QoreException object is destroyed
descthe description string for the exception; the ExceptionSink object takes ownership of the reference count
stacka call stack to prepend to the Qore call stack
Returns
always returns nullptr
Since
Qore 0.8.13

◆ raiseExceptionArg() [4/5]

DLLEXPORT AbstractQoreNode* ExceptionSink::raiseExceptionArg ( const QoreProgramLocation &  loc,
const char *  err,
QoreValue  arg,
QoreStringNode desc 
)

appends a Qore-language exception to the list, and sets the 'arg' member (this object takes over the reference counts of 'arg' and 'desc')

The AbstractQoreNode pointer returned is always 0; used to simplify error handling code.

Parameters
locthe source location for the exception
errthe exception code string
argthe 'arg' member of the Qore-language exception object; will be dereferenced when the QoreException object is destroyed
descthe description string for the exception; the ExceptionSink object takes ownership of the reference count
Returns
always returns nullptr
Since
Qore 0.9

◆ raiseExceptionArg() [5/5]

DLLEXPORT AbstractQoreNode* ExceptionSink::raiseExceptionArg ( const QoreProgramLocation &  loc,
const char *  err,
QoreValue  arg,
QoreStringNode desc,
const QoreCallStack stack 
)

appends a Qore-language exception to the list, and sets the 'arg' member (this object takes over the reference counts of 'arg' and 'desc')

The AbstractQoreNode pointer returned is always 0; used to simplify error handling code.

Parameters
locthe source location for the exception
errthe exception code string
argthe 'arg' member of the Qore-language exception object; will be dereferenced when the QoreException object is destroyed
descthe description string for the exception; the ExceptionSink object takes ownership of the reference count
stacka call stack to prepend to the Qore call stack
Returns
always returns nullptr
Since
Qore 0.9

The documentation for this class was generated from the following file:
ExceptionSink
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:48