Fix for pr 'separate exceptions for multiple requests'

This commit is contained in:
boni 2018-08-24 20:40:16 +03:00
parent f17d7e9c5e
commit 58b9e74569
2 changed files with 4 additions and 4 deletions

View File

@ -52,7 +52,7 @@ class UserMethods(TelegramBaseClient):
exceptions.append(None)
results.append(result)
request_index += 1
if exceptions:
if any(x is not None for x in exceptions):
raise MultiError(exceptions, results, requests)
else:
return results

View File

@ -78,13 +78,13 @@ class MultiError(Exception):
raise ValueError(
'Need result, exception and request for each error')
for e, req in zip(exceptions, requests):
if not isinstance(e, BaseException):
if not isinstance(e, BaseException) and e is not None:
raise TypeError(
'Expected and exception object, not %r' % e
"Expected an exception object, not '%r'" % e
)
if not isinstance(req, TLRequest):
raise TypeError(
'Expected TLRequest object, not %r' % req
"Expected TLRequest object, not '%r'" % req
)
if len(exceptions) == 1: