Actor Framework Discussions

Showing results for 
Search instead for 
Did you mean: 

Central Error Handler in the Actor Framework

I'm just curious if anyone has any thoughts about best practices for creating a centralized error handler in the actor framework.  The main concern I'm struggling with is whether to put all the error handling within my top level actor (first image) or should it be its own actor (second image).  Any thoughts/suggestions are appreciated.  Thanks.


Top Down.jpg

0 Kudos
Message 1 of 6

I would recommend using the "Handle" in Actor Framework.  There is a class too called "Report Error Msg" that may be in the experimental fork of AF that you can use to send an error that happens in an actor to the actor's caller.  Often it is useful to tell the caller of the actor about the method about the error and have the caller handle the error.  That would mean that you would need to override the Handle in the callee to tell the caller about the error and then override the Handle in the caller to actually handle the error.

I have additionally built a data logger actor that you can send an error message and the class name of the actor and write it to a log file.  In that scenario I have a separate actor for error logging.  I pass the queue reference for the logger to my component actors so they can send an error message in their override of Handle

Hope some of these ideas help.  I plan to post some actors that I have written to the community at some point, just too busy with other work currently.


Casey Lamers

Phoenix, LLC

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 2 of 6

CaseyLamers1 wrote:

I plan to post some actors that I have written to the community at some point, just too busy with other work currently.

I suspect that lots of us are thinking the same thing! Some week I'll get the time to clean up all my reuse code, document it lightly, and publish it for others to use!

0 Kudos
Message 3 of 6

There is a Structured Error Handler Reference Library which seems to be a good candidate for a central error handler actor.

In the discussion forum Oli Wachno already suggested to turn it into an actor. I also feel it could fit the Actor Framework.

If I were you I would try to change the Central Error Handler of it into an actor and change the incoming errors into messages. I have no idea if it would be easy or not, so sorry if it leads to a dead end.

0 Kudos
Message 4 of 6

The SEH uses an FGV for error handling. That will break the true asynchronicity of Actors running alongside each other. As such, I recommend against using it for a central error handler. I'm also unsure whether NI Systems Engineering plans to maintain that library any further.

Moore Good Ideas has an error logging/reporting library on the VI Package Manager servers that I used in my AF extension class, and it's working very well so far. It uses a queue in Windows and an RT FIFO in LVRT for pushing errors to a dynamically launched central handler.

0 Kudos
Message 5 of 6

For now I've decided to use the Structured Error Handler library to filter and categorize errors and then pass those errors back up the tree using an error message class in the handle error VI of each actor.  The error handling logic will be in the handle error vi of the top level actor.

0 Kudos
Message 6 of 6