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

Error class handlers and logger print (unexpected) errors in Websocket middleware #355

Open
emschwartz opened this issue Nov 9, 2016 · 0 comments

Comments

@emschwartz
Copy link
Contributor

emschwartz commented Nov 9, 2016

While working on getting two ledgers and a connector set up, @dappelt found the following issues:

Both our error classes and koa-riverpig assume that they are being used in a normal Koa context. However, when combined with koa-websocket (as in here), the this value normally set by koa is instead undefined. In both cases, it seems that an error is logged (with debug so you need DEBUG=* to see it) but the app continues running so it's not critical but they should probably be fixed nonetheless.

For the error classes, an (unexpected) error is logged when the handler tries to set properties on the context here. You should be able to reproduce this by trying to subscribe to transfers for an account that doesn't exist.

In koa-riverpig, there is a similar problem where it tries to access fields on the koa context without checking if they exist. This appears to happen whenever you subscribe to an account that does exist. The specific error printed is:

2016-11-09T14:22:49.251Z koa:websocket debug TypeError: Cannot read property 'once' of undefined
   at Object.logMiddleware (.../five-bells-ledger/node_modules/koa-riverpig/dist/src/index.js:60:12)
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