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

Exception when use({}) #7

Open
yowu opened this issue May 19, 2020 · 3 comments
Open

Exception when use({}) #7

yowu opened this issue May 19, 2020 · 3 comments

Comments

@yowu
Copy link

yowu commented May 19, 2020

MiddlewareManager.use will throw exception if an empty object is passed as parameter.

Callstack

TypeError: _this._methodMiddlewares[methodName].push is not a function
at Array.forEach (<anonymous>)
at MiddlewareManager._applyToMethod
at Array.forEach (<anonymous>)
at Array.forEach (<anonymous>)
at MiddlewareManager.use 

Probably need to reject the empty object at the beginning.

@unbug
Copy link
Owner

unbug commented May 19, 2020

Hum, please follow the doc to use Middleware object https://github.com/unbug/js-middleware#middleware-object

@yowu
Copy link
Author

yowu commented May 19, 2020

You can't rely on the caller always does the right thing. A proper edge case protection may make the library more robust. It's just my two cents.

@unbug
Copy link
Owner

unbug commented May 19, 2020

Feel free to contribute your changes though.

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

2 participants