Vuo  2.0.0
Public Member Functions | List of all members
VuoCompilerException Class Reference

Description

An exception containing a list of issues that occurred while compiling a composition.

At least one of the issues should be an error (otherwise there's no reason to throw an exception). The issues may also include warnings.

Currently, compiler functions handle VuoCompilerIssues in two different ways. The older way is to create a new VuoCompilerIssue if there's an error and throw a VuoCompilerException for it. The newer way is for the function to have a VuoCompilerIssues parameter, for it to append errors and warnings to those VuoCompilerIssues, and for it to throw a VuoCompilerException containing those VuoCompilerIssues if there's an error. Unless you know that the function and its callees are all using the older way or all using the newer way, the recommended pattern for callers to handle both possibilities is:

Example:
try {
fun(issues);
} catch (VuoCompilerException &e) {
if (e.getIssues() != issues)
issues->append(e.getIssues());
}
cout << issues->getLongDescription(); // or whatever you want to do with issues

Definition at line 41 of file VuoCompilerException.hh.

Public Member Functions

 VuoCompilerException (const VuoCompilerIssue &issue)
 Constructor. More...
 
 VuoCompilerException (VuoCompilerIssues *issues, bool ownsIssues)
 Constructor. More...
 
 ~VuoCompilerException (void) throw ()
 Needed to prevent a build error. More...
 
VuoCompilerIssuesgetIssues (void) const
 Returns the list of issues. More...
 
const char * what () const throw ()
 Returns an HTML-formatted string containing short descriptions of all issues. More...
 
- Public Member Functions inherited from VuoException
 VuoException (const string &description, bool log=true)
 Creates an exception with the specified description, collects the current stack trace, and optionally logs both. More...
 
 ~VuoException (void) throw ()
 Needed to prevent a build error. More...
 
const char * what () const throw ()
 Returns the description. More...
 
const vector< string > & getBacktrace ()
 Returns the stack trace when creating this exception. More...
 

Constructor & Destructor Documentation

◆ VuoCompilerException() [1/2]

VuoCompilerException::VuoCompilerException ( const VuoCompilerIssue issue)

Constructor.

Definition at line 16 of file VuoCompilerException.cc.

◆ VuoCompilerException() [2/2]

VuoCompilerException::VuoCompilerException ( VuoCompilerIssues issues,
bool  ownsIssues 
)

Constructor.

If isOwner is true, the created VuoCompilerException is responsible for deallocating issues. Otherwise, the caller is responsible.

Definition at line 30 of file VuoCompilerException.cc.

◆ ~VuoCompilerException()

VuoCompilerException::~VuoCompilerException ( void  )
throw (
)

Needed to prevent a build error.

Destructor.

Definition at line 41 of file VuoCompilerException.cc.

Member Function Documentation

◆ getIssues()

VuoCompilerIssues * VuoCompilerException::getIssues ( void  ) const

Returns the list of issues.

Definition at line 51 of file VuoCompilerException.cc.

◆ what()

const char * VuoCompilerException::what ( ) const
throw (
)

Returns an HTML-formatted string containing short descriptions of all issues.

Definition at line 59 of file VuoCompilerException.cc.


The documentation for this class was generated from the following files: