Added artiq exception example
This commit is contained in:
parent
eb750eb1f0
commit
3d5515866f
20
examples/exception.py
Normal file
20
examples/exception.py
Normal file
@ -0,0 +1,20 @@
|
||||
from artiq.experiment import *
|
||||
|
||||
class ExceptionDemo(EnvExperiment):
|
||||
def build(self):
|
||||
self.setattr_device("core")
|
||||
self.setattr_device("led0")
|
||||
|
||||
@kernel
|
||||
def run(self):
|
||||
self.core.reset()
|
||||
print("OK!")
|
||||
try:
|
||||
try:
|
||||
raise Exception
|
||||
except ValueError as e:
|
||||
print("re-raise")
|
||||
raise e
|
||||
except:
|
||||
print("error")
|
||||
|
Loading…
Reference in New Issue
Block a user