Skip to content

Commit 7735089

Browse files
committed
fix exception integration test
1 parent bdc399d commit 7735089

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/apify/_actor.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,9 @@ async def __aexit__(
216216
if self._is_exiting:
217217
return
218218

219+
if exc_value:
220+
self.exit_code = ActorExitCodes.ERROR_USER_FUNCTION_THREW.value
221+
219222
self._raise_if_not_initialized()
220223

221224
if exc_value and not is_running_in_ipython():

tests/integration/test_actor_lifecycle.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
from typing import TYPE_CHECKING
44

5+
from apify_shared.consts import ActorExitCodes
6+
57
from apify import Actor
68

79
if TYPE_CHECKING:
@@ -115,7 +117,7 @@ async def main() -> None:
115117
actor = await make_actor(label='with-actor-fail', main_func=main)
116118
run_result = await run_actor(actor)
117119

118-
assert run_result.exit_code == 91
120+
assert run_result.exit_code == ActorExitCodes.ERROR_USER_FUNCTION_THREW.value
119121
assert run_result.status == 'FAILED'
120122

121123

0 commit comments

Comments
 (0)