combine KeyError & IndexError to common base class LookupError
This commit is contained in:
parent
f1c853c6ef
commit
bc0e853d30
@ -1098,7 +1098,7 @@ class TwitterAPI():
|
|||||||
else:
|
else:
|
||||||
raise KeyError()
|
raise KeyError()
|
||||||
|
|
||||||
except (KeyError, IndexError):
|
except LookupError:
|
||||||
extr.log.debug(data)
|
extr.log.debug(data)
|
||||||
|
|
||||||
if self._user:
|
if self._user:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Copyright 2015-2021 Mike Fährmann
|
# Copyright 2015-2022 Mike Fährmann
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License version 2 as
|
# it under the terms of the GNU General Public License version 2 as
|
||||||
@ -168,7 +168,7 @@ def parse_bytes(value, default=0, suffixes="bkmgtp"):
|
|||||||
"""Convert a bytes-amount ("500k", "2.5M", ...) to int"""
|
"""Convert a bytes-amount ("500k", "2.5M", ...) to int"""
|
||||||
try:
|
try:
|
||||||
last = value[-1].lower()
|
last = value[-1].lower()
|
||||||
except (TypeError, KeyError, IndexError):
|
except (TypeError, LookupError):
|
||||||
return default
|
return default
|
||||||
|
|
||||||
if last in suffixes:
|
if last in suffixes:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user