File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ var AuthTokenInvalidError = scErrors.AuthTokenInvalidError;
15
15
var AuthTokenNotBeforeError = scErrors . AuthTokenNotBeforeError ;
16
16
var AuthTokenError = scErrors . AuthTokenError ;
17
17
var SilentMiddlewareBlockedError = scErrors . SilentMiddlewareBlockedError ;
18
+ var InvalidArgumentsError = scErrors . InvalidArgumentsError ;
18
19
var InvalidOptionsError = scErrors . InvalidOptionsError ;
19
20
var InvalidActionError = scErrors . InvalidActionError ;
20
21
var BrokerError = scErrors . BrokerError ;
@@ -639,6 +640,10 @@ SCServer.prototype.generateId = function () {
639
640
} ;
640
641
641
642
SCServer . prototype . addMiddleware = function ( type , middleware ) {
643
+ if ( ! this . _middleware [ type ] ) {
644
+ throw new InvalidArgumentsError ( `Middleware type "${ type } " is not supported` ) ;
645
+ // Read more: https://socketcluster.io/#!/docs/middleware-and-authorization
646
+ }
642
647
this . _middleware [ type ] . push ( middleware ) ;
643
648
} ;
644
649
You can’t perform that action at this time.
0 commit comments