Skip to content

check if middleware does exist#24

Merged
jondubois merged 3 commits into
SocketCluster:masterfrom
MegaGM:10.0.0-breaking-changes
Mar 11, 2018
Merged

check if middleware does exist#24
jondubois merged 3 commits into
SocketCluster:masterfrom
MegaGM:10.0.0-breaking-changes

Conversation

@MegaGM

@MegaGM MegaGM commented Mar 10, 2018

Copy link
Copy Markdown
Member

Give a proper error message instead of ambigous

TypeError: Cannot read property 'push' of undefined

Comment thread scserver.js Outdated

SCServer.prototype.addMiddleware = function (type, middleware) {
if (!this._middleware[type]) {
throw new InvalidArgumentsError(`Middleware type "${type}" is not supported. \nRead more: https://socketcluster.io/#!/docs/middleware-and-authorization`)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid \n new lines and references to websites inside error messages (keep them simple), but feel free to add references to the website inside comments above the error message if you like.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also missing semicolon at the end of the line.

@jondubois jondubois merged commit ffbc954 into SocketCluster:master Mar 11, 2018
@MegaGM MegaGM deleted the 10.0.0-breaking-changes branch March 12, 2018 13:15
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

Successfully merging this pull request may close these issues.

2 participants