Skip to content

Commit

Permalink
python: Propogate Config.browse errors
Browse files Browse the repository at this point in the history
  • Loading branch information
shramov committed Dec 23, 2024
1 parent e984eeb commit 0aa24a3
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions python/tll/config.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,19 @@ cdef class Config:
class appender(list):
def __init__(self, sub):
self.sub = sub
self.exc = None
def __call__(self, k, v):
if v.value() or self.sub:
self.append((k, v.get()))
try:
if v.value() or self.sub:
self.append((k, v.get()))
except Exception as e:
self.exc = (str(k), e)
raise

_cb = appender(subpath) if cb is None else cb
tll_config_browse(self._ptr, m, len(m), browse_cb, <void *>_cb)
if tll_config_browse(self._ptr, m, len(m), browse_cb, <void *>_cb):
if cb is None:
raise RuntimeError(f"Browse failed on key '{_cb.exc[0]}'") from _cb.exc[1]
if cb is None:
return list(_cb)

Expand Down

0 comments on commit 0aa24a3

Please sign in to comment.