Skip to content

Commit

Permalink
disable notifications for common delivery errors
Browse files Browse the repository at this point in the history
  • Loading branch information
tompesman committed Nov 2, 2012
1 parent 70a06b9 commit 093cf33
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/push/message_gcm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def check_for_error(connection)
hsh = MultiJson.load(response.body)
if hsh["failure"] == 1
msg = hsh["results"][0]["error"]
Push::Daemon.logger.error("[#{connection.name}] Error received.")

# MissingRegistration, handled by validation
# MismatchSenderId, configuration error by client
Expand All @@ -40,10 +41,10 @@ def check_for_error(connection)
Push::FeedbackGcm.create!(:app => connection.provider.configuration[:name], :failed_at => Time.now,
:device => device, :follow_up => 'delete')
end
raise Push::DeliveryError.new(response.code, id, msg, "GCM", false)
else
raise Push::DeliveryError.new(response.code, id, msg, "GCM")
end

Push::Daemon.logger.error("[#{connection.name}] Error received.")
raise Push::DeliveryError.new(response.code, id, msg, "GCM")
elsif hsh["canonical_ids"] == 1
# success, but update device token
update_to = hsh["results"][0]["registration_id"]
Expand Down

0 comments on commit 093cf33

Please sign in to comment.