Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug when bot leaves room (when storage is enabled)?? #18

Open
bradh11 opened this issue Feb 2, 2018 · 0 comments
Open

Bug when bot leaves room (when storage is enabled)?? #18

bradh11 opened this issue Feb 2, 2018 · 0 comments
Assignees

Comments

@bradh11
Copy link

bradh11 commented Feb 2, 2018

Receiving an error message when bot leaves a room. I believe the .catch on line 1966 is the root cause. Removing the catch stops the error from occurring.

TypeError: driver.forget.call(...).catch is not a function
    at Flint.forgetByRoomId (/root/spaceman/node_modules/node-flint/lib/flint.js:1966:15)
    at Flint.despawn (/root/spaceman/node_modules/node-flint/lib/flint.js:1758:10)
    at Flint.onMembershipDeleted (/root/spaceman/node_modules/node-flint/lib/flint.js:1379:17)
    at /root/spaceman/node_modules/node-flint/lib/webhook.js:142:22
    at Layer.handle [as handle_request] (/root/spaceman/node_modules/express/lib/router/layer.js:95:5)
    at next (/root/spaceman/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/root/spaceman/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/root/spaceman/node_modules/express/lib/router/layer.js:95:5)
    at /root/spaceman/node_modules/express/lib/router/index.js:281:22
    at Function.process_params (/root/spaceman/node_modules/express/lib/router/index.js:335:12)
    at next (/root/spaceman/node_modules/express/lib/router/index.js:275:10)
    at /root/spaceman/node_modules/body-parser/lib/read.js:130:5
    at invokeCallback (/root/spaceman/node_modules/raw-body/index.js:224:16)
    at done (/root/spaceman/node_modules/raw-body/index.js:213:7)
    at IncomingMessage.onEnd (/root/spaceman/node_modules/raw-body/index.js:273:7)
    at emitNone (events.js:106:13)

With the lines below commented out, the error does not occur. Do we need this .catch here if we are throwing an error further below in the else statement?>

  // validate storage module forget() method
  if(typeof driver.forget === 'function') {
    Bot.prototype.forget = function(key) {
      var id = this.room.id;
      return driver.forget.call(driver, id, key);
    };

    Flint.prototype.forgetByRoomId = function(roomId) {
      return driver.forget.call(driver, roomId)
        // .catch(err => {
        //   // ignore errors when called by forgetByRoomId
        //   return when(null);
        // });
    };
  } else {
    throw new Error('storage module missing forget() function');
  }
@nmarus nmarus self-assigned this Feb 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants