-
Notifications
You must be signed in to change notification settings - Fork 100
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
Handle encoding/coercing/validation in the encoder #167
Conversation
@@ -135,7 +135,7 @@ def callable_rpc_method(method_name) | |||
# Register a failure callback for use when rpc_failed is invoked. | |||
# | |||
def on_rpc_failed(callable) | |||
@_rpc_failed_callback ||= callable | |||
@_rpc_failed_callback = callable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why this would be useful, but I left it in while setting up a default. It allowed me to cleanup the dispatcher.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was going to mention it, it's a kind of wonky pattern (I created) with the method handle. Rather than the send, I'd just have that method return a lambda, or just set the lambda in the initializer directly. Chalk it up as another "feature" that never materialized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In other words, KILL IT!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider it done.
Rather than having the dispatcher coerce and validate responses or handle that in a separate middleware, move it all into the encoder.
Instead of providing a callback hook that is fired when rpc_failed is called, just take the given message and raise an RPC failed error.
Handle encoding/coercing/validation in the encoder
Closes #154 |
Handle encoding/coercing/validation in the encoder
Rather than having the dispatcher coerce and validate responses or handle that in a separate middleware, move it all into the encoder.
This should make it easier for other middlewares to hook in before or after the coercion and validation.
// @localshred @abrandoned