Skip to content

Commit 046f901

Browse files
feat: Assign watsonResponse.output.error to message.watsonError (#180)
Assign watsonResponse.output.error to message.watsonError
2 parents 62947d9 + 5a5d90b commit 046f901

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

lib/index.js

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,10 @@ export class WatsonMiddleware {
166166

167167
const watsonRequest = await this.before(message, payload);
168168
let watsonResponse = await postMessage(this.conversation, watsonRequest);
169+
if (typeof watsonResponse.output.error === 'string') {
170+
debug('Error: %s', watsonResponse.output.error);
171+
message.watsonError = watsonResponse.output.error;
172+
}
169173
watsonResponse = await this.after(message, watsonResponse);
170174

171175
message.watsonData = watsonResponse;

0 commit comments

Comments
 (0)