-
Notifications
You must be signed in to change notification settings - Fork 61
Open
Description
I’ve been noticing odd issues when using native calls for a while, but now I have a simple reproducer:
@pyscript_compile
def test_native(log):
async def native(callback):
log("native start")
res = await callback()
log(f"native callback result {res}")
return res
return native
def callback_func():
res = 0 / 0
return res
def test_exception():
log.info("start")
try:
test_native(log.info)(callback_func)
log.info("no exception")
except Exception as e:
log.info(f"got exception {e}")
log.info("end")
@time_trigger("once(now+3s)")
def start():
log.info("start time_trigger")
test_exception()
log.info("stop time_trigger")
test_exception()Output:
start
native start
native callback result None <-----
got exception division by zero
end
#3 sec
start time_trigger
start
native start
native callback result None <-----
no exception
end
stop time_trigger
With a direct call, the exception is raised, but note line native callback result None - it shouldn’t be there.
When called via a trigger - the exception is swallowed complete
Metadata
Metadata
Assignees
Labels
No labels