wingbot 3.74.6 → 3.74.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wingbot",
3
- "version": "3.74.6",
3
+ "version": "3.74.7",
4
4
  "description": "Enterprise Messaging Bot Conversation Engine",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",
@@ -128,7 +128,13 @@ class WingbotModel extends CachedModel {
128
128
  return { intents: [], entities: [] };
129
129
  }
130
130
 
131
- const response = await res.json();
131
+ const responseText = await res.text();
132
+ let response;
133
+ try {
134
+ response = JSON.parse(responseText);
135
+ } catch (e) {
136
+ throw new Error(`[${res.status}] Invalid JSON response: ${responseText}`);
137
+ }
132
138
 
133
139
  if (this._options.verbose) this._log.log(`#NLP: ${text} [response]`, response);
134
140