Skip to content
This repository has been archived by the owner on Oct 18, 2022. It is now read-only.

useErrorHandlerMiddleware doesn't act like other functions. #9

Closed
ben-ryder opened this issue Mar 3, 2022 · 2 comments
Closed

useErrorHandlerMiddleware doesn't act like other functions. #9

ben-ryder opened this issue Mar 3, 2022 · 2 comments
Assignees
Labels
bug Something isn't working package/error-handler issues related to @kangojs/error-handler

Comments

@ben-ryder
Copy link
Owner

Package Information: error-handler@0.1.0

Describe the bug
Various other use... function in KangoJS all work by passing in the express app like useX(app, config) but useErrorHandlerMiddlewaredoesn't. It should work the same way to keep things consistent.

To Reproduce
Attempt to use useErrorHandlerMiddleware and you will see it must be used like app.use(useErrorHandlerMiddleware(config)); rather than useErrorHandlerMiddleware(app, config).

Expected behaviour
Error handling middleware should be setup with useErrorHandlerMiddleware(app, config)

System Information
n/a

Additional context
n/a

@ben-ryder ben-ryder added bug Something isn't working package/error-handler issues related to @kangojs/error-handler labels Mar 3, 2022
@ben-ryder ben-ryder self-assigned this Mar 3, 2022
@ben-ryder ben-ryder changed the title useErrorHandlerMiddleware doesn't act like other useX functions. useErrorHandlerMiddleware doesn't act like other functions. Mar 3, 2022
@ben-ryder
Copy link
Owner Author

This is actually worse than I first thought. You must actually put:

    app.use(useErrorHandlerMiddleware({
        errorHandlerConfig: {}
    }));

I managed to put app.use(useErrorHandlerMiddleware); which causes the middleware not to work and sensitive error messages are exposed in responses!

@ben-ryder
Copy link
Owner Author

Should be all sorted as of error-handler v0.2.4

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working package/error-handler issues related to @kangojs/error-handler
Projects
None yet
Development

No branches or pull requests

1 participant