toodledo 1.3.4 → 1.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +4 -0
- data/lib/toodledo.rb +1 -1
- data/lib/toodledo/session.rb +15 -5
- metadata +3 -3
data/History.txt
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
== 1.3.5 / 2010-10-15
|
2
|
+
|
3
|
+
* Patches for raising a better error when no internet connection, recovering from state where no internet + token expired.
|
4
|
+
|
1
5
|
== 1.3.4 / 2010-10-08
|
2
6
|
|
3
7
|
* More patches for reestablishing connection, based off file modification time as well as :tokenexpires
|
data/lib/toodledo.rb
CHANGED
data/lib/toodledo/session.rb
CHANGED
@@ -221,6 +221,9 @@ module Toodledo
|
|
221
221
|
|
222
222
|
# make the call
|
223
223
|
response = http.request_get(url.request_uri, HEADERS)
|
224
|
+
unless response
|
225
|
+
raise Toodledo::ServerError.new("No HTTP response found from request #{url.path}");
|
226
|
+
end
|
224
227
|
body = response.body
|
225
228
|
|
226
229
|
# body = url.read
|
@@ -233,18 +236,25 @@ module Toodledo
|
|
233
236
|
end
|
234
237
|
|
235
238
|
root_node = doc.root
|
239
|
+
retry_error = nil
|
236
240
|
if (root_node.name == 'error')
|
237
241
|
error_text = root_node.text
|
238
|
-
|
242
|
+
case error_text
|
243
|
+
when 'Invalid ID number' then
|
239
244
|
raise Toodledo::ItemNotFoundError.new(error_text)
|
240
|
-
|
241
|
-
|
242
|
-
# May want to get uncached token here as a recovery mechanism?
|
245
|
+
when 'key did not validate', 'No Key Specified' then
|
246
|
+
retry_error = true
|
243
247
|
else
|
244
248
|
raise Toodledo::ServerError.new(error_text)
|
245
249
|
end
|
246
250
|
end
|
247
|
-
|
251
|
+
|
252
|
+
if (retry_error)
|
253
|
+
logger.debug("call(#{method}): invalid key, reconnecting") if logger
|
254
|
+
reconnect(@base_url, @proxy);
|
255
|
+
root_node = call(method, params);
|
256
|
+
end
|
257
|
+
|
248
258
|
return root_node
|
249
259
|
end
|
250
260
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 1.3.
|
8
|
+
- 5
|
9
|
+
version: 1.3.5
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Will Sargent
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-10-
|
17
|
+
date: 2010-10-15 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|