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

Socket 404 Handler #1854

Open
ultm8m opened this issue Mar 6, 2020 · 2 comments
Open

Socket 404 Handler #1854

ultm8m opened this issue Mar 6, 2020 · 2 comments

Comments

@ultm8m
Copy link

ultm8m commented Mar 6, 2020

I'm looking to change the response of the Feathers error handler for an erroneous socket request.

Adding a handler to apps.hooks.js works for sockets if the service exists and there is an error, but i'm looking to handle the error if the service does not exist.

Socket Response to non-existent service

Socket responds with:
431[{"name":"NotFound","message":"Service '<script>alert("test")</script>' not found","code":404,"className":"not-found","errors":{}}]

I'd like to change the default error handler to remove the message.

@ultm8m
Copy link
Author

ultm8m commented Mar 6, 2020

I found where the error is throw from:
@feathersjs/transports-commons/lib/socket/utils.js, Line 70
return Promise.reject(new errors_1.default.NotFound(`Service '${path}' not found`));

https://github.com/feathersjs/feathers/blob/master/packages/transport-commons/src/socket/utils.ts#L84

Is there a way to override this within the Feathers app?

@daffl
Copy link
Member

daffl commented Mar 9, 2020

There is currently not but it might be a good idea to be able to add some kind of middleware.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants