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

Add exception when the session key cannot be retrieved from the db #129

Open
modulitos opened this issue May 18, 2015 · 1 comment
Open

Comments

@modulitos
Copy link

(Migrated from the doc: https://docs.google.com/document/d/1qenf2HZAv6OnpyU0tUbh0ZfeJG_Rqb_MfkcNqd_YgTk/edit)

this error when (I think) there's a non-admin user:

/Users/sethvincent/workspace/flatsheet/flatsheet/routes/sheets.js:26
      if (account.admin) {
                 ^
TypeError: Cannot read property 'admin' of undefined
    at /Users/sethvincent/workspace/flatsheet/flatsheet/routes/sheets.js:26:18
    at /Users/sethvincent/workspace/flatsheet/flatsheet/lib/permissions.js:12:21
    at /Users/sethvincent/workspace/flatsheet/flatsheet/lib/index.js:117:30
    at /Users/sethvincent/workspace/flatsheet/flatsheet/node_modules/cookie-auth/index.js:46:21
    at dispatchError (/Users/sethvincent/workspace/flatsheet/flatsheet/node_modules/subleveldown/node_modules/levelup/lib/util.js:77:7)
    at /Users/sethvincent/workspace/flatsheet/flatsheet/node_modules/subleveldown/node_modules/levelup/lib/levelup.js:222:14
@modulitos
Copy link
Author

I was unable to reproduce the last error on that Google Doc. It seems to occur when permissions.authorizeSession(req, res, function (err, account, session) { executes the callback with a falsey err and account is undefined. This means that self.accountdown.get(session.data.username, function (accountError, account) { cannot find the session, but does not return an error. Thus, the sessions would be in some kind of an unusual state where the session key does not have a value. I can add an extra check that covers this issue.

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

1 participant