@@ -61,16 +61,21 @@ def get_all_iter(self, method, max_count, values=None, key='items',
6161 count = None
6262
6363 while True :
64- try :
65- response = vk_get_all_items (
66- self . vk , method , key , values , count , offset ,
67- offset_mul = - 1 if negative_offset else 1
68- )
69- except ApiError :
64+ response = vk_get_all_items (
65+ self . vk , method , key , values , count , offset ,
66+ offset_mul = - 1 if negative_offset else 1
67+ )
68+
69+ if 'execute_errors' in response :
7070 raise VkToolsException (
71- 'Can\' t load items. Check access to requested items'
71+ 'Could not load items: {}' .format (
72+ response ['execute_errors' ]
73+ ),
74+ response = response
7275 )
7376
77+ response = response ['response' ]
78+
7479 items = response ["items" ]
7580 items_count += len (items )
7681
@@ -202,6 +207,7 @@ def get_all_slow(self, method, max_count, values=None, key='items',
202207vk_get_all_items = VkFunction (
203208 args = ('method' , 'key' , 'values' , 'count' , 'offset' , 'offset_mul' ),
204209 clean_args = ('method' , 'key' , 'offset' , 'offset_mul' ),
210+ return_raw = True ,
205211 code = '''
206212 var params = %(values)s,
207213 calls = 0,
@@ -217,6 +223,9 @@ def get_all_slow(self, method, max_count, values=None, key='items',
217223 var response = API.%(method)s(params),
218224 new_count = response.count,
219225 count_diff = (count == null ? 0 : new_count - count);
226+ if (!response) {
227+ return {"_error": 1};
228+ }
220229
221230 if (count_diff < 0) {
222231 offset = offset + count_diff;
0 commit comments