Skip to content

Commit e797cab

Browse files
committed
chore(query_list): Preserve output of original errors via logging
1 parent c5c5ec9 commit e797cab

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/libtmux/_internal/query_list.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@
55
This is an internal API not covered by versioning policy.
66
"""
77

8+
import logging
89
import re
910
import traceback
1011
import typing as t
1112
from collections.abc import Iterable, Mapping, Sequence
1213

14+
logger = logging.getLogger(__name__)
15+
1316
if t.TYPE_CHECKING:
1417

1518
class LookupProtocol(t.Protocol):
@@ -100,8 +103,9 @@ def keygetter(
100103
elif hasattr(dct, sub_field):
101104
dct = getattr(dct, sub_field)
102105

103-
except Exception:
106+
except Exception as e:
104107
traceback.print_stack()
108+
logger.debug(f"The above error was {e}")
105109
return None
106110

107111
return dct
@@ -140,8 +144,9 @@ def parse_lookup(
140144
field_name = path.rsplit(lookup)[0]
141145
if field_name is not None:
142146
return keygetter(obj, field_name)
143-
except Exception:
147+
except Exception as e:
144148
traceback.print_stack()
149+
logger.debug(f"The above error was {e}")
145150
return None
146151

147152

0 commit comments

Comments
 (0)