LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error/Warning Handling for the Actor Framework

I have a central error logger that is another actor.  I store the reference to its enqueuer in the data of the class that needs to send things to the error logger.  Then you override the Handle Error.vi.  Read the error logger enqueuer and send an error message to it.  You will need to have your error logger be able to receive a message that is an error, but that is pretty easy.  Using inheritance you can even put this method in a parent class so that you don't need to write the code over and over.  Regarding warnings, you could have code that detects a warning and changes it to an error, then have a Handle Error.vi override for that error code that changes it back to a warning or clears it all together.  When you override Handle Error.vi you can choose not to stop the actor by wiring a false boolean to that output.

 

If you want more detail on how I do it send me a message.

 

Casey

Casey Lamers


Phoenix, LLC


casey.lamers@phoenixwi.com


CLA, LabVIEW Champion


Check Out the Software Engineering Processes, Architecture, and Design track at NIWeek. 2018 I guarantee you will learn things you can use daily! I will be presenting!

0 Kudos
Message 11 of 15
(1,026 Views)

I also have a parallel process that does my error logging for me. Your idea makes sense to me. Converting a warning to an error sounds good, but that means that the developer also needs to remember to always include the subvi that performs this conversion in every method I write. I could use inheritance to override a method that would always perform this conversion and that would belong to a parent class inheriting directly from Actor.lvclass. However, that would mean that every method for every class I make would need to override this method, and it would, therefore, always have the same name. 

0 Kudos
Message 12 of 15
(1,008 Views)

Have a case structure in the parent class Handle Error.vi that looks at the code.  Default case is the Call Parent Method for Handle Error.vi.  Specific cases you can convert to the warning.  You will have to update the case structure if you add more codes that you want to change to warnings.

Casey Lamers


Phoenix, LLC


casey.lamers@phoenixwi.com


CLA, LabVIEW Champion


Check Out the Software Engineering Processes, Architecture, and Design track at NIWeek. 2018 I guarantee you will learn things you can use daily! I will be presenting!

0 Kudos
Message 13 of 15
(1,004 Views)

Here is a photo of the Handle Error I use in my parent "Component" class.

Casey Lamers


Phoenix, LLC


casey.lamers@phoenixwi.com


CLA, LabVIEW Champion


Check Out the Software Engineering Processes, Architecture, and Design track at NIWeek. 2018 I guarantee you will learn things you can use daily! I will be presenting!

0 Kudos
Message 14 of 15
(1,003 Views)

I may be missing the mark, and this may not be how you wanted to handle errors, but I use an FGV to handle errors in my actors.  It isn't automatic since you have to consciously add the FGV to the VIs being processed by the "Do" VI, but it can be used across actors without issue, and handles both errors and warnings, and can even change errors to warnings or let the errors (or lack of an error) pass through to the next process.

Another method is when I know I will have children classes of an actor parent, I use the parent process to capture the children's errors

Actor Parent error capture.png

Actor Parent error capture in child.png

and pass them back to the main actor controller to handle, rather than let the actor error handler stop that actor and freeze the rest of my program.

0 Kudos
Message 15 of 15
(866 Views)