Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed fallback exception from version change logic. (#2283) #2298

Merged
merged 1 commit into from
Jun 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions libraries/botbuilder-dialogs/src/dialogContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,7 @@ export abstract class DialogContainer<O extends object = {}> extends Dialog<O> {
// Give bot an opportunity to handle the change.
// - If bot handles it the changeHash will have been updated as to avoid triggering the
// change again.
const handled = await dc.emitEvent(DialogEvents.versionChanged, this.id, true, false);
if (!handled) {
// Throw an error for bot to catch
throw new Error(`Version change detected for '${this.id}' dialog.`);
}
await dc.emitEvent(DialogEvents.versionChanged, this.id, true, false);
}
}
}
42 changes: 0 additions & 42 deletions libraries/botbuilder-dialogs/tests/componentDialog.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,48 +391,6 @@ describe('ComponentDialog', function () {
.assertReply('Second step.')
.assertReply('Done.')
});

it('should throw error if unhandled dialogChange event.', (done) => {
const conversationState = new ConversationState(new MemoryStorage());
const dialogState = conversationState.createProperty('dialog');

const childDialog = new WaterfallDialog('child', [
async step => {
component.addDialog(new WaterfallDialog('change'));
await step.context.sendActivity('First step.');
return Dialog.EndOfTurn;
},
async step => {
await step.context.sendActivity('Second step.');
return await step.endDialog();
}
]);
const component = new ChangedDialog('test', false);
component.addDialog(childDialog);

const dialogs = new DialogSet(dialogState);
dialogs.add(component);

const adapter = new TestAdapter(async turnContext => {
try {
const dc = await dialogs.createContext(turnContext);
const results = await dc.continueDialog();

if (results.status === DialogTurnStatus.empty) {
await dc.beginDialog('test');
}
await conversationState.saveChanges(turnContext);
} catch (err) {
await turnContext.sendActivity('Done.')
done();
}
});

adapter.send('Hi')
.assertReply('First step.')
.send('Hi again')
.assertReply('Done.')
});
});


Expand Down