Skip to content

Commit

Permalink
Thrown errors in client sagas are now logged to console.
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyanziano committed Feb 27, 2020
1 parent 49f2346 commit bffe200
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
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
13 changes: 9 additions & 4 deletions packages/app/client/src/state/utils/throwErrorFromResponse.ts
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();
error.innerMessage = errText;
const errText = yield text.call(response);
(error as ResponseError).innerMessage = errText;
}
if (statusText) {
error.description = `${response.status} ${response.statusText}`;
(error as ResponseError).description = `${response.status} ${response.statusText}`;
} else {
error.description = response.status + '';
(error as ResponseError).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;
}

0 comments on commit bffe200

Please sign in to comment.