@tiledesk/tiledesk-tybot-connector 2.0.5 → 2.0.6

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": "@tiledesk/tiledesk-tybot-connector",
3
- "version": "2.0.5",
3
+ "version": "2.0.6",
4
4
  "description": "Tiledesk Tybot connector",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -38,25 +38,24 @@ class DirWebResponse {
38
38
  async go(action, callback) {
39
39
  winston.debug("DirWebResponse action: ", action);
40
40
 
41
- let requestAttributes = null;
42
- let status = null;
43
- if (this.tdcache) {
44
- requestAttributes =
45
- await TiledeskChatbot.allParametersStatic(this.tdcache, this.requestId);
46
- const filler = new Filler();
47
-
48
- try {
49
- status = filler.fill(action.status, requestAttributes);
50
- }
51
- catch(e) {
52
- winston.error("DirWebResponse Error: ", e)
53
- }
54
-
41
+ if (!this.tdcache) {
42
+ winston.error("DirWebResponse Error: tdcache is mandatory");
43
+ callback();
44
+ return;
55
45
  }
56
-
46
+
47
+ let requestAttributes = null;
48
+ requestAttributes =
49
+ await TiledeskChatbot.allParametersStatic(
50
+ this.tdcache, this.requestId
51
+ );
52
+
53
+ const filler = new Filler();
54
+ const filled_status = filler.fill(action.status, requestAttributes);
57
55
  const json = await this.getJsonFromAction(action, filler, requestAttributes)
56
+
58
57
  let webResponse = {
59
- status: status,
58
+ status: filled_status,
60
59
  payload: json
61
60
  }
62
61