Skip to content

check if middleware does exist #24

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

Merged
merged 3 commits into from
Mar 11, 2018

Conversation

MegaGM
Copy link
Member

@MegaGM MegaGM commented Mar 10, 2018

Give a proper error message instead of ambigous

TypeError: Cannot read property 'push' of undefined

scserver.js Outdated
@@ -639,6 +639,9 @@ SCServer.prototype.generateId = function () {
};

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
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
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