You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
which means the AnyCable::Middlewares::Exceptions catches the error raised in Yabeda::AnyCable::Middleware but not the error which is raised by the channel.
Possible solutions
Handling within yabeda-anycable
One way to fix it is to check if response object responds to :status method. A commit with such fix.
Changing the order in the middleware chain
Another solution would probably be to change the order in the middleware chain. If Yabeda::AnyCable::Middleware is listed before the AnyCable::Middlewares::Exceptions, it also works as expected.
However, AnyCable::MiddlewareChain.use only allows to append the middleware to the chain, there aren't any #insert_before or #insert_after methods available on the AnyCable::MiddlewareChain. We could add such methods to AnyCable::MiddlewareChain first, and then use them within this library.
Summary
Are there some other ways to resolve the issue I haven't thought of? I wonder what do you think which approach should be used to resolve it?
The text was updated successfully, but these errors were encountered:
Context
Library versions
Description of the problem
Let's say I have a channel with a method that contains a bug.
When a message is sent from the client, when I use yebeda-anycable, the logs output this error
instead of warning me about a missing method which is the actual problem in the codebase.
This happens due to
response
being nil in this line when an error was raised from the channel object.By default the yabeda-anycable middleware is added to the middleware chain in the 3rd place.
which means the
AnyCable::Middlewares::Exceptions
catches the error raised in Yabeda::AnyCable::Middleware but not the error which is raised by the channel.Possible solutions
Handling within yabeda-anycable
One way to fix it is to check if
response
object responds to:status
method. A commit with such fix.Changing the order in the middleware chain
Another solution would probably be to change the order in the middleware chain. If
Yabeda::AnyCable::Middleware
is listed before theAnyCable::Middlewares::Exceptions
, it also works as expected.However,
AnyCable::MiddlewareChain.use
only allows to append the middleware to the chain, there aren't any#insert_before
or#insert_after
methods available on theAnyCable::MiddlewareChain
. We could add such methods toAnyCable::MiddlewareChain
first, and then use them within this library.Summary
Are there some other ways to resolve the issue I haven't thought of? I wonder what do you think which approach should be used to resolve it?
The text was updated successfully, but these errors were encountered: