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

Chi should not panic when no routes #362

Closed
makhov opened this issue Nov 26, 2018 · 4 comments
Closed

Chi should not panic when no routes #362

makhov opened this issue Nov 26, 2018 · 4 comments

Comments

@makhov
Copy link

makhov commented Nov 26, 2018

Hello!

We use a generic service skeleton based on chi in our company. Sometimes we needn't handle http-request and our skeleton creates chi.Mux with no roures.

If someone try to ping our service, it fails with panic because of this if section.

I think Chi should return 404 error instead of panic.

@VojtechVitek
Copy link
Contributor

VojtechVitek commented Nov 26, 2018

Why don't you add a 404 handler in your skeleton app's code?

I'm not sure if this is the right call. The panic might be useful for some folks that forget to mount the handlers correctly.

Let's poll the community for their opinions:
👍 for HTTP 404; 👎 for keeping the panic as is; 🎉 for panicking at the startup time

@makhov
Copy link
Author

makhov commented Nov 26, 2018

I understood your point, but in this case we create a service which can panic at the random moment when someone send any http request. And developer don't know about this behavior.

Maybe we should panic at service startup

@VojtechVitek
Copy link
Contributor

@makhov that's a good point, thanks. Let me add it as a third option to the poll.

@pkieltyka
Copy link
Member

done in #378 -- in v4, we will return 404 for an empty mux

@pkieltyka pkieltyka mentioned this issue Jan 8, 2019
5 tasks
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

3 participants