Jump to content

Should Actor Core call "Handle Error" when an error is passed directly into it?

Recommended Posts

I was debugging an application today and tracked it down to an error being passed directly into Actor Core from an initialization method upstream.


I had expected the error on occasion and have a case in my Handle Error override to display a front panel warning to the user.


My oversight was thinking that Actor Core would call Handle Error if an error was passed directly into it. This isn't the case, of course: it skips running any of its code and passes the error straight through.


Should an error passed into Actor Core call Handle Error? I assume this was considered and discarded for some reason. Anyone have any insight as to why?



Link to comment

Errors in initialization are passed back to the calling VI, with an error meaning that the actor failed to launch.  This seems reasonable to me.  And you can handle the error in “Pre Launch Init” if you prefer the actor to launch anyway (note that you can call “Handle Error” n “Pre Launch Init” if you want).

Link to comment
 (note that you can call “Handle Error” n “Pre Launch Init” if you want).


I've been avoiding doing certain initialization steps in "Pre Launch Init," especially if they involve launching actors or references. So this has to take place in the Actor Core override, I think. If I can actually package all the initialization in Pre Launch Init, then that'd be welcome news, though.


There's a whole thread on the AF community forum about this error propagation and why it is done this way. 


I'm guessing this is a trivial discussion to find if you know what you're looking for, but my searches turned up a bit fruitless. Is it this thread on Pre-Launch errors - or this thread on warnings? My Google fu is a bit weak, I fear.

Link to comment

You cannot put launching of nested actors into Pre-Launch Init.vi. That will deadlock because Pre-Launch Init is mutually exclusive with any other actor launching (by design -- it provides the bottleneck where you can acquire multiple resources without worrying that other actors are acquiring those resources at the same moment). Acquisition of resources for references generally works best there. Doing your Launch Actor (soon to be Launch Nested Actor) there won't work. 


https://decibel.ni.com/content/thread/18246 is the thread you want... including my comments on why I believe you would never want to call "Handle Error.vi" in "Pre-Launch Init.vi"... it just can't really be the same handler when an actor is running as when an actor is not yet running. The things you do to "handle" the error are entirely different. 

  • Like 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.