Trying to create a dragscript to do a shutdown on error

So I have created my first successful basic dragscript. After I manually power up everything in my dome I run the drag script and successfully complete an imaging session using a single sequence that I have done in on the fly. When the sequence is SUCCESSFULLY completed the dragscript shuts everything down and turns off the power to everything as designed. The problem I have is I am unable to have the dragscript shut everything down and turn off the power if there is a problem during the imaging sequence. By problem I mean I forgot to take the lens cap off or worse there is a communication error with the dome and the dome continually rotates forever. The continual Dome rotation actually occurred in the middle of the night. Luckily my dog started barking and woke me up allowing me to shut off the power after the dome spent about 15 minutes in continuous rotation.
I tried using the watch dog in the auto focus set up screen for the HFD being out of range or zero. My thought was that it would be zero if I left the lens cap on and way out of range if the dome was rotating and the sky was no longer visible to the telescope. In actual testing leaving the lens cap on I received an error message regarding the watchdog showing the HFD as zero but unfortunately it had no effect on discontinuing the on-the-fly sequence and shutting everything down. The dragstrip just kept running as if nothing was wrong. Any suggestions regarding what to put in the dragscript would be greatly appreciated. Also I don’t see where I can add a photo here of the dragscript to help clarify what I am talking about. I hate to share the dragscript on the share page as it’s extremely basic and doesn’t quite work like I want it and would not be helpful to anybody looking for a good dragscript example.
All the best,
Bob Masters

Hi,

Take a look to the official perpetual script. It does handle errors very nicely.

Cheers,

I finally got it to recognize an error and shut down everything. Simple mistake of not checking the box in the actual sequence generated from on the fly to do the good night when there is an error in the sequence. I found this point in the fine print in the dragscript that the function had been discontinued in the drag script and had to be done from the on-the-fly sequence.:man_facepalming::man_shrugging:t3:
Bob

No discontinued Bob just isnt possible to manage this kind of features if yoy run sequence from the DragScript. You have the DragScript itself for replace the on end on error and more