Skip to content

Commit 19248f8

Browse files
Adding subscribe
1 parent 93491e3 commit 19248f8

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

aws_lambda_powertools/event_handler/appsync_events.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,17 +138,26 @@ def resolve(
138138
return response
139139

140140
def _subscribe_events(self) -> Any:
141-
"""Handle subscribe events"""
141+
"""
142+
Handle subscribe events.
143+
144+
Returns
145+
-------
146+
Any
147+
Any response
148+
"""
142149
channel_path = self.current_event.info.channel_path
143150
logger.debug(f"Processing subscribe events for path {channel_path}")
144151

145152
resolver = self._subscribe_registry.find_resolver(channel_path)
146-
if not resolver:
147-
self._warn_no_resolver("subscribe", channel_path)
148-
return None
153+
if resolver:
154+
try:
155+
return resolver["func"]()
156+
except Exception as error:
157+
return {"error": self._format_error_response(error)}
149158

150-
# Implementation for subscribe events would go here
151-
pass
159+
self._warn_no_resolver("subscribe", channel_path)
160+
return None
152161

153162
def _publish_events(self, payload: list[dict[str, Any]]) -> list[dict[str, Any]] | dict[str, Any]:
154163
"""

0 commit comments

Comments
 (0)