Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/leopard/message_processor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,13 @@ def base_app(handler, callbacks)
lambda do |wrapper|
result = execute_handler.call(wrapper, handler)
process_result(wrapper, result, callbacks)
# TODO: document that middleware functions are expected to propagate result
# https://github.com/rubyists/leopard/issues/48
result
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why wouldn't #process_result just return a Result?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm not sure i'm following. so we need to pass the result of actually executing the handler to the middleware chain. process_result just takes the result that is returned and calls the appropriate callback for the transport (req/reply or jetstream).

rescue StandardError => e
logger.error 'Error processing message: ', e
callbacks[:on_error].call(wrapper, e)
Dry::Monads::Result::Failure.new(e)
end
end

Expand Down
Loading