-
Notifications
You must be signed in to change notification settings - Fork 16
Exception Handling
Aaron Wisner edited this page Sep 21, 2016
·
4 revisions
TODO
Process can raise and catch custom exceptions using raiseException()
and handleException()
.
Return true from handleException()
to catch the Exception, otherwise it will propagate down to the scheduler overseeing it, and the virtual scheduler.handleException()
will be called to catch the exception. By default, it will restart the faulting process (disable, destroy, add, then enable it).
Create your own custom exceptions using enums:
Note: Negative values are reserved for the Scheduler
// Example
typedef enum ExceptionCodes
{
LostCommunicationException = 0,
InvalidReadingException,
UnknownException,
//etc...
} ExceptionCodes;
Now you can raise your own Exception from within a process: raiseException(LostCommunicationException)
Enable by uncommenting _PROCESS_EXCEPTION_HANDLING
in config.h