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

Cannot abort save before object exists #35

Open
toomim opened this issue Oct 9, 2017 · 0 comments
Open

Cannot abort save before object exists #35

toomim opened this issue Oct 9, 2017 · 0 comments

Comments

@toomim
Copy link
Member

toomim commented Oct 9, 2017

This server code crashes:

bus = require('./statebus').serve({file_store: false})
bus('foo').to_save = (o, t) => {t.abort()}

When you do this in a client:

save({key: '/foo', _: 3})

Because the t.abort() implementation currently assumes that the object exists in the cash. We get this stacktrace:

No obj undefined
TypeError: Cannot read property 'key' of undefined
    at Function.save.abort (statebus.js:222:27)
    at Object.t.abort (statebus.js:792:30)
    at c.to_save (test.js:6:19)
    at statebus.js:841:31
    at funk (statebus.js:959:35)
    at Function.run_handler (statebus.js:897:16)
    at bus.route (statebus.js:908:17)
    at Function.bus.route (statebus.js:1754:20)
    at Function.save (statebus.js:141:36)
    at SockJSConnection.<anonymous> (server.js:339:26)
events.js:182
      throw er; // Unhandled 'error' event
      ^
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