ARTIQ Zynq-based core device support
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
artiq-zynq/examples/exception.py

38 lines
806 B

from artiq.experiment import *
from artiq.language.core import TerminationRequested
class ExceptionDemo(EnvExperiment):
def build(self):
self.setattr_device("core")
self.setattr_device("led0")
def foo(self):
print("raise error")
raise Exception
def termination(self):
raise TerminationRequested
@rpc
def remote(self):
raise Exception
@kernel
def run(self):
self.core.reset()
try:
try:
self.foo()
except ValueError as e:
print("should not trigger this")
except:
print("catch all")
try:
self.remote()
except:
print("Error!")
print("Uncaught error at last")
self.termination()