lib/rhosync/ping/android.rb in rhosync-2.1.17.beta4 vs lib/rhosync/ping/android.rb in rhosync-2.1.17.beta5
- old
+ new
@@ -24,10 +24,18 @@
raise StaleAuthToken.new(
"Stale auth token, please update :authtoken: in settings.yml."
)
# body will contain the exception class
elsif response.body =~ /^Error=(.*)$/
- raise AndroidPingError.new("Android ping error: #{$1 || ''}")
+ err = $1
+ if err =~ /NotRegistered/
+ client = Client.load(params['client_id'],{:source_name => '*'})
+ client.phone_id = nil
+ client.device_pin = nil
+ client.device_port = nil
+ else
+ raise AndroidPingError.new("Android ping error: #{err || ''}")
+ end
else
response.return!(request, result, &block)
end
when 401, 403
raise InvalidAuthToken.new("Invalid auth token, please update :authtoken: in settings.yml.")