Skip to content

Commit 8bb42d9

Browse files
refactor: address feedback
1 parent e06460e commit 8bb42d9

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/aws_durable_execution_sdk_python/execution.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,10 @@ def wrapper(event: Any, context: LambdaContext) -> MutableMapping[str, Any]:
224224
invocation_input = DurableExecutionInvocationInput.from_dict(event)
225225
except (KeyError, TypeError, AttributeError) as e:
226226
msg = (
227-
"The function is not being invoked as a durable function. "
228-
"Please check the function configuration to ensure durability is turned on, "
229-
"or use the testing SDK for local testing."
227+
"The payload is not the correct Durable Function input. "
228+
"Please set DurableConfig on the AWS Lambda to invoke it as a Durable Function."
230229
)
231-
raise ValueError(msg) from e
230+
raise ExecutionError(msg) from e
232231

233232
# Local runner always uses its own client, otherwise use custom or default
234233
if invocation_input.is_local_runner:

tests/execution_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2036,8 +2036,8 @@ def test_handler(event: Any, context: DurableContext) -> dict:
20362036
# WHEN the handler is invoked with a non-durable payload
20372037
# THEN it raises a ValueError with a helpful message
20382038
with pytest.raises(
2039-
ValueError,
2040-
match="The function is not being invoked as a durable function",
2039+
ExecutionError,
2040+
match="The payload is not the correct Durable Function input",
20412041
):
20422042
test_handler(regular_event, lambda_context)
20432043

@@ -2064,7 +2064,7 @@ def test_handler(event: Any, context: DurableContext) -> dict:
20642064
# WHEN the handler is invoked with a non-dict event
20652065
# THEN it raises a ValueError with a helpful message
20662066
with pytest.raises(
2067-
ValueError,
2068-
match="The function is not being invoked as a durable function",
2067+
ExecutionError,
2068+
match="The payload is not the correct Durable Function input",
20692069
):
20702070
test_handler(non_dict_event, lambda_context)

0 commit comments

Comments
 (0)