Skip to content

Commit 6b95f4c

Browse files
committed
chore(query_list): Preserve output of original errors via logging
1 parent fcf0ec6 commit 6b95f4c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/libvcs/_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
T = t.TypeVar("T")
1417
no_arg = object()
1518

@@ -84,8 +87,9 @@ def keygetter(
8487
dct = dct[sub_field]
8588
elif hasattr(dct, sub_field):
8689
dct = getattr(dct, sub_field)
87-
except Exception:
90+
except Exception as e:
8891
traceback.print_stack()
92+
logger.debug(f"The above error was {e}")
8993
return None
9094
return dct
9195

@@ -119,8 +123,9 @@ def parse_lookup(obj: Mapping[str, t.Any], path: str, lookup: str) -> t.Optional
119123
field_name = path.rsplit(lookup)[0]
120124
if field_name is not None:
121125
return keygetter(obj, field_name)
122-
except Exception:
126+
except Exception as e:
123127
traceback.print_stack()
128+
logger.debug(f"The above error was {e}")
124129
return None
125130

126131

0 commit comments

Comments
 (0)