Actor Framework Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Is Handle Error only used for message processing errors?

I did an override of Handle Error expecting I could let an error in my override of Actor Core propagate through to the parent. The parent Actor Core code suggests that an Error In will pass through to Handle Error (skipping any message processing), however my override is not being called and my Actor appears to be stopping.

Is my understanding of the purpose of Handle Error in "error"?

0 Kudos
Message 1 of 13
(6,313 Views)

Handle Error is called from the parent's actor core. Any code in your actor core is parallel to the parent's actor core, as you probably forked the wire before the "call parent node" VI. Handle error handles errors in the parent thread, i.e. message handling; your actor core needs its own error handling.

Or in other words: Yes, Handle Error is used only for message processing errors.

Thanks,

Danielle

"Wisdom comes from experience. Experience is often a result of lack of wisdom.”
― Terry Pratchett
Message 2 of 13
(4,584 Views)

An alternative way of stating it... if you have errors in your parallel code and you want them to be processed by Handle Errors, you need to send a message to yourself that says "please process this error" -- and let the Do method just pass that error out.

The "Send Error Report.vi" in the palettes does exactly this.

Message 3 of 13
(4,584 Views)

AristosQueue wrote:

An alternative way of stating it... if you have errors in your parallel code and you want them to be processed by Handle Errors, you need to send a message to yourself that says "please process this error" -- and let the Do method just pass that error out.

The "Send Error Report.vi" in the palettes does exactly this.

Thank you, sir. I also found the thread at https://decibel.ni.com/content/message/89022#89022. I especially like your post #9 in that thread and will be looking at taking that philosophy into my own app. Time to scrap the old LabVIEW error handling paradigm and swap in the new.

I'd also like to thank you and your partner(s) in crime for coming up with this great design pattern. It's very satisfying when you get your application working and you know it's a lot more robust and scaleable than it would have been otherwise.

Message 4 of 13
(4,584 Views)

You're welcome.

Message 5 of 13
(4,584 Views)

Although an old thread, I decided to post here since it's on the same subject.

I am struggling to understand how an Actor "quits" in the error case. I setup my project thusly:

  1. A top level (root) actor with an override of actor core.
  2. Before calling the parent actor core, send an Error Report to self.
  3. In the override of Handle Error, a General Error handler I placed displays a dialog of the error. I hit continue.
  4. The message handling loop in the parent actor core terminates and calls "Stop".
  5. The override of Stop Core simply calls the parent method.
  6. The parent Stop Core is supposed to send Stop messages to any nested actors.
  7. The parent Actor Core then exits back to my override of Actor Core.
  8. My Actor Core would assumedly then exit since it's at the end of the method.

What happens is my root actor exits normally if I DONT send an Error Report.

When I send an Error Report, my root actor does NOT exit (libraries are all locked). Trying this same scenario with nested actors and none of them get Stop messages. With no error going into parent Actor Core, any nested actors all stop normally.

Is the description of Stop Core correct that: "By default this method does nothing....." because the code itself shows sending a stop message to the array of nested actor enqueuers.

0 Kudos
Message 6 of 13
(4,584 Views)

Just a 'shot in the blue': Is your error handler configured to cancel the error?

0 Kudos
Message 7 of 13
(4,584 Views)

I don't have to cancel the error. The default error handling makes it "go away". Sure, it is returned to my override of Actor Core in my root actor after the call to the parent Actor Core, but at that point the application is terminating anyway. For my project, application errors are always fatal and always result in the application doing an exit (after informing the user what happened).

0 Kudos
Message 8 of 13
(4,584 Views)

The shutting down of the nested actors is new in LV 2014... and I guess I forgot to update the Context Help. I'll CAR that to fix for LV 2017 (2016 is already done).

(CAR 593676 filed)

0 Kudos
Message 9 of 13
(4,584 Views)

If you pass an error directly into Actor:Actor Core.vi, you will not trip Handle Error at all, but it will still trip Stop.vi, which will unconditionally call Stop Core. There's no way around that behavior.

> When I send an Error Report, my root actor does NOT exit (libraries are all locked).

I cannot explain that behavior. It works fine in all of my tests -- I send an error with Send Error Report.vi and all the actors stop.

If you use Send Error Report.vi... make sure that you're actually sending an error? I mean, if the value you wire in is "no error", then it would have the behavior you describe. I know that's almost insulting like asking "have you tried plugging it in?" but I'm at a loss to explain the behavior otherwise.

0 Kudos
Message 10 of 13
(4,584 Views)