Skip to content
This repository was archived by the owner on Jan 5, 2026. It is now read-only.

Commit 3b2071c

Browse files
authored
Adding confirm prompt to Core Bot and fix on that sample error handling (#280)
1 parent 1f541e4 commit 3b2071c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

samples/Core-Bot/adapter_with_error_handler.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def __init__(
2121
self._conversation_state = conversation_state
2222

2323
# Catch-all for errors.
24-
async def on_error(self, context: TurnContext, error: Exception):
24+
async def on_error(context: TurnContext, error: Exception):
2525
# This check writes out errors to console log
2626
# NOTE: In production environment, you should consider logging this to Azure
2727
# application insights.
@@ -34,6 +34,7 @@ async def on_error(self, context: TurnContext, error: Exception):
3434
)
3535
await context.send_activity(error_message)
3636
# Clear out state
37+
nonlocal self
3738
await self._conversation_state.delete(context)
3839

3940
self.on_turn_error = on_error

samples/Core-Bot/dialogs/booking_dialog.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def __init__(self, dialog_id: str = None):
1616
super(BookingDialog, self).__init__(dialog_id or BookingDialog.__name__)
1717

1818
self.add_dialog(TextPrompt(TextPrompt.__name__))
19-
# self.add_dialog(ConfirmPrompt(ConfirmPrompt.__name__))
19+
self.add_dialog(ConfirmPrompt(ConfirmPrompt.__name__))
2020
self.add_dialog(DateResolverDialog(DateResolverDialog.__name__))
2121
self.add_dialog(
2222
WaterfallDialog(
@@ -25,7 +25,7 @@ def __init__(self, dialog_id: str = None):
2525
self.destination_step,
2626
self.origin_step,
2727
self.travel_date_step,
28-
# self.confirm_step,
28+
self.confirm_step,
2929
self.final_step,
3030
],
3131
)
@@ -133,7 +133,6 @@ async def final_step(self, step_context: WaterfallStepContext) -> DialogTurnResu
133133

134134
if step_context.result:
135135
booking_details = step_context.options
136-
booking_details.travel_date = step_context.result
137136

138137
return await step_context.end_dialog(booking_details)
139138
return await step_context.end_dialog()

0 commit comments

Comments
 (0)