combine KeyError & IndexError to common base class LookupError
This commit is contained in:
parent
f1c853c6ef
commit
bc0e853d30
@ -1098,7 +1098,7 @@ class TwitterAPI():
|
||||
else:
|
||||
raise KeyError()
|
||||
|
||||
except (KeyError, IndexError):
|
||||
except LookupError:
|
||||
extr.log.debug(data)
|
||||
|
||||
if self._user:
|
||||
|
@ -1,6 +1,6 @@
|
||||
# -*- 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
|
||||
# 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"""
|
||||
try:
|
||||
last = value[-1].lower()
|
||||
except (TypeError, KeyError, IndexError):
|
||||
except (TypeError, LookupError):
|
||||
return default
|
||||
|
||||
if last in suffixes:
|
||||
|
Loading…
x
Reference in New Issue
Block a user