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

Thrown errors in client sagas are now logged to console. #2087

Merged
merged 1 commit into from
Feb 28, 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [client] Fixed an issue where pressing enter opens the Azure government website instead of connecting to the bot [2073](https://github.com/microsoft/BotFramework-Emulator/pull/2073)
- [build] Changed one-click installer to assisted installer with new graphics. Also updated application icon in PR [2077](https://github.com/microsoft/BotFramework-Emulator/pull/2077)
- [build] Locked `eslint-plugin-import@2.20.0` to avoid unecessary import linting changes in PR [2081](https://github.com/microsoft/BotFramework-Emulator/pull/2081)
- [client] Thrown errors in client-side sagas will now be logged in their entirety to the dev tools console in PR [2087](https://github.com/microsoft/BotFramework-Emulator/pull/2087)

## Removed
- [client/main] Removed legacy payments code in PR [2058](https://github.com/microsoft/BotFramework-Emulator/pull/2058)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,18 @@ export function* throwErrorFromResponse(errorMessage: string, response: Response
status,
};
if (text) {
const errText = yield text();
const errText = yield text.call(response);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was also throwing the following error:

TypeError: Failed to execute 'text' on 'Response': Illegal invocation

because text() was being called outside of the response context.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is good for now. But we just do a try catch block around all our sagas and log them.

error.innerMessage = errText;
}
if (statusText) {
error.description = `${response.status} ${response.statusText}`;
} else {
error.description = response.status + '';
}
/*
* temporary way to surface saga errors until we update to redux-saga@^1.0.0 and can use top-level onError hook
* (see https://github.com/redux-saga/redux-saga/issues/1308)
*/
console.error('Saga error: ', error); // eslint-disable-line
throw error;
}