From 208eed4696446f55756379642b086a897d0621b9 Mon Sep 17 00:00:00 2001 From: Jeff Derstadt Date: Wed, 22 Aug 2018 15:44:42 -0700 Subject: [PATCH 1/3] Better error handling for getSessionId --- src/directLine.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/directLine.ts b/src/directLine.ts index d667fcbce..c89644bd0 100644 --- a/src/directLine.ts +++ b/src/directLine.ts @@ -496,10 +496,16 @@ export class DirectLine implements IBotConnection { } }) .map(ajaxResponse => { - konsole.log("getSessionId response: " + ajaxResponse.response.sessionId); - return ajaxResponse.response.sessionId as string; + if (ajaxResponse && ajaxResponse.response && ajaxResponse.response.sessionId) { + konsole.log("getSessionId response: " + ajaxResponse.response.sessionId); + return ajaxResponse.response.sessionId as string; + } + return ''; + }) + .catch(error => { + konsole.log("getSessionId error: " + error.status); + return Observable.of(''); }) - .catch(error => this.catchPostError(error)) ) .catch(error => this.catchExpiredToken(error)); } From a96469f588a4c8ee4bf1f334623fde9f828d0d7a Mon Sep 17 00:00:00 2001 From: William Wong Date: Wed, 22 Aug 2018 23:37:43 -0700 Subject: [PATCH 2/3] Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0efab8604..352b975d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Changed +- Add handling of 403/500 for `getSessionId`, in [#87](https://github.com/Microsoft/BotFramework-WebChat/pull/87) ## [0.9.16] - 2018-08-14 ### Added From 4f21e85531cfc6dbafa55a6bab29c934abf9be2e Mon Sep 17 00:00:00 2001 From: William Wong Date: Thu, 23 Aug 2018 00:02:55 -0700 Subject: [PATCH 3/3] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 352b975d6..84e6149b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] ### Changed -- Add handling of 403/500 for `getSessionId`, in [#87](https://github.com/Microsoft/BotFramework-WebChat/pull/87) +- Add handling of 403/500 for `getSessionId`, in [#87](https://github.com/Microsoft/BotFramework-DirectLineJS/pull/87) ## [0.9.16] - 2018-08-14 ### Added