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

Improved error logging when opening a bot via URL in debug mode #1949

Merged
merged 2 commits into from
Nov 5, 2019
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Fixed
- [client] Added an empty state for the recent bots submenu in the app menu for Windows in PR [1945](https://github.com/microsoft/BotFramework-Emulator/pull/1945)
- [client] Fixed a bug that was showing the custom user ID validation message when disabled in PR [1946](https://github.com/microsoft/BotFramework-Emulator/pull/1946)
- [client] Improved error logging when opening a bot via URL in debug mode in PR [1949](https://github.com/microsoft/BotFramework-Emulator/pull/1949)

## v4.6.0 - 2019 - 10 - 31
## Added
Expand Down
8 changes: 6 additions & 2 deletions packages/app/client/src/state/sagas/botSagas.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,15 @@ describe('The botSagas', () => {
gen.next({ id: 'someConversationId' });
// POSTing to the conversation should return a 400
const errorNotification = beginAdd(
newNotification('An error occurred while POSTing "/INSPECT open" command to conversation someConversationId')
newNotification(
'An error occurred while POSTing "/INSPECT open" command to conversation someConversationId: Bad request: Something went wrong :('
)
);
(errorNotification as any).payload.notification.timestamp = jasmine.any(Number);
(errorNotification as any).payload.notification.id = jasmine.any(String);
expect(gen.next({ statusCode: 400 }).value).toEqual(put(errorNotification));
expect(
gen.next({ response: { status: 'Bad request', message: 'Something went wrong :(' }, statusCode: 400 }).value
).toEqual(put(errorNotification));
});

it('should spawn a notification if parsing the conversation id from the response fails', () => {
Expand Down
11 changes: 9 additions & 2 deletions packages/app/client/src/state/sagas/botSagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,21 @@ export class BotSagas {
type: 'message',
text: '/INSPECT open',
};
const postActivityResponse: ResourceResponse & { statusCode: number } = yield call(
const postActivityResponse: ResourceResponse & {
statusCode: number;
response?: { message: string; status: number | string };
} = yield call(
[BotSagas.commandService, BotSagas.commandService.remoteCall],
SharedConstants.Commands.Emulator.PostActivityToConversation,
conversationId,
activity
);
if (postActivityResponse.statusCode > 399) {
error = `An error occurred while POSTing "/INSPECT open" command to conversation ${conversationId}`;
const { message = 'Message unavailable.', status = 'Status unavailable' } =
postActivityResponse.response || {};
error =
`An error occurred while POSTing "/INSPECT open" command to conversation ${conversationId}: ` +
`${status}: ${message}`;
}
} else {
error = 'An error occurred while trying to grab conversation ID from the new conversation.';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
display: block;
text-align: right;
min-width: 0;
margin-right: 20px;
margin: 0 20px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
Expand Down