Is there a way to use `StatusPages` plugin on web ...
# ktor
a
Is there a way to use
StatusPages
plugin on web socket routes? I would like to throw an exceptions in all my routes and handle it from one place, this plugin by default only work with Http methods routes like get, post But not web socket, is there an alternative solution?
👍 1
a
Can you describe the problem you are trying to solve?
a
Thank you for the reply. I want an alternative of this plugin https://ktor.io/docs/server-status-pages.html But instead of using it only in http routes, I would like to use it in web socket routes, for example I have an exception
ErrorResponseException
that hold some variables (message, data etc...) I already setup this easily using the status pages plugin, I can throw exceptions inside the route handler and handle them in one place (in the place where I install the plugin) I want so when I throw an exception, it stop the route handler code execution and fallback to the code that will run for a specific exception
a
There is no such functionality for WebSockets because the pipelines aren't involved in the WebSockets communication.
👍 2
And unfortunately, I cannot find a central place where all those exceptions could be caught.
👍 1
a
Me too. Thank you once again.