mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-03-25 08:55:50 +00:00
http(request): collates status checks
This commit is contained in:
parent
605f878f9b
commit
02350c924b
1 changed files with 4 additions and 6 deletions
|
|
@ -257,12 +257,6 @@ async def request(
|
|||
# some other error, will be handled later on
|
||||
break
|
||||
|
||||
if response.status == 429:
|
||||
raise UsageLimitReached(response.reason)
|
||||
|
||||
if response.status == 403 and await _is_quota_exceeded_google(response):
|
||||
raise UsageLimitReached(response.reason)
|
||||
|
||||
# See https://github.com/kennethreitz/requests/issues/2042
|
||||
content_type = response.headers.get("Content-Type", "")
|
||||
if (
|
||||
|
|
@ -281,10 +275,14 @@ async def request(
|
|||
# https://github.com/pimutils/vdirsyncer/issues/1186
|
||||
logger.debug(await response.text())
|
||||
|
||||
if response.status == 403 and await _is_quota_exceeded_google(response):
|
||||
raise UsageLimitReached(response.reason)
|
||||
if response.status == 412:
|
||||
raise exceptions.PreconditionFailed(response.reason)
|
||||
if response.status in (404, 410):
|
||||
raise exceptions.NotFoundError(response.reason)
|
||||
if response.status == 429:
|
||||
raise UsageLimitReached(response.reason)
|
||||
|
||||
response.raise_for_status()
|
||||
return response
|
||||
|
|
|
|||
Loading…
Reference in a new issue