From 3126dd17a46f079c93d5f12ffcb1be4025d57ecc Mon Sep 17 00:00:00 2001 From: Tony Anziano Date: Thu, 27 Feb 2020 11:13:30 -0800 Subject: [PATCH] Thrown errors in client sagas are now logged to console. --- CHANGELOG.md | 1 + .../app/client/src/state/utils/throwErrorFromResponse.ts | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a76737c64..0a67f9636 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/packages/app/client/src/state/utils/throwErrorFromResponse.ts b/packages/app/client/src/state/utils/throwErrorFromResponse.ts index 95121ea13..995710bd9 100644 --- a/packages/app/client/src/state/utils/throwErrorFromResponse.ts +++ b/packages/app/client/src/state/utils/throwErrorFromResponse.ts @@ -50,7 +50,7 @@ export function* throwErrorFromResponse(errorMessage: string, response: Response status, }; if (text) { - const errText = yield text(); + const errText = yield text.call(response); error.innerMessage = errText; } if (statusText) { @@ -58,5 +58,10 @@ export function* throwErrorFromResponse(errorMessage: string, response: Response } 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; }