Skip to content

Commit 893a67e

Browse files
Jeffderscompulim
authored andcommitted
Better error handling for getSessionId (#87)
* Better error handling for getSessionId * Update CHANGELOG.md * Update CHANGELOG.md
1 parent 3612205 commit 893a67e

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
### Changed
9+
- Add handling of 403/500 for `getSessionId`, in [#87](https://github.com/Microsoft/BotFramework-DirectLineJS/pull/87)
810

911
## [0.9.16] - 2018-08-14
1012
### Added

src/directLine.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -496,10 +496,16 @@ export class DirectLine implements IBotConnection {
496496
}
497497
})
498498
.map(ajaxResponse => {
499-
konsole.log("getSessionId response: " + ajaxResponse.response.sessionId);
500-
return ajaxResponse.response.sessionId as string;
499+
if (ajaxResponse && ajaxResponse.response && ajaxResponse.response.sessionId) {
500+
konsole.log("getSessionId response: " + ajaxResponse.response.sessionId);
501+
return ajaxResponse.response.sessionId as string;
502+
}
503+
return '';
504+
})
505+
.catch(error => {
506+
konsole.log("getSessionId error: " + error.status);
507+
return Observable.of('');
501508
})
502-
.catch(error => this.catchPostError(error))
503509
)
504510
.catch(error => this.catchExpiredToken(error));
505511
}

0 commit comments

Comments
 (0)