Skip to content

Commit

Permalink
Add notes for the temporary implementation about errors
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Jan 29, 2014
1 parent adfbf95 commit e905e16
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/droonga/distributor_plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ def process_error(command, error, arguments)
end
end

#XXX Now, default scatterer/broadcaster/reducer/gatherer includes
# definitions to merge errors in the body. However, this makes
# the term "errors" reserved, so plugins cannot use their custom
# "errors" in the body. This must be rewritten.

def scatterer(message, key)
{
"command" => message["type"],
Expand Down
3 changes: 3 additions & 0 deletions lib/droonga/handler_messenger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ def error(status_code, body)
"body" => body)
@replier.reply(response)
else
#XXX This is just a temporary solution. We should rewrite this,
# to put errors outside of the message body. Otherwise
# plugins cannot use the name "errors" for their message body.
body = {
"id" => @message.id,
"input" => "errors",
Expand Down
1 change: 1 addition & 0 deletions lib/droonga/output_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def adapt(message)
end

private
#XXX This is just a temporary solution. We should handle errors without "body", for safety.
def adapt_errors(output_message)
if output_message.body.include?("errors")
errors = output_message.body["errors"]
Expand Down

0 comments on commit e905e16

Please sign in to comment.