dev: harden resolver bootstrap and simplify update settings

This commit is contained in:
2026-02-24 16:18:44 +01:00
parent 99b67a24f8
commit 16e4b5f261
8 changed files with 298 additions and 71 deletions

View File

@@ -23,6 +23,7 @@ def resolve(url: str) -> Optional[str]:
try:
import resolveurl # type: ignore
except Exception:
_LAST_RESOLVE_ERROR = "resolveurl missing"
return None
try:
@@ -36,7 +37,10 @@ def resolve(url: str) -> Optional[str]:
resolver = getattr(hmf, "resolve", None)
if callable(resolver):
result = resolver()
return str(result) if result else None
if result:
return str(result)
_LAST_RESOLVE_ERROR = "unresolved"
return None
except Exception as exc:
_LAST_RESOLVE_ERROR = str(exc or "")
pass
@@ -45,7 +49,10 @@ def resolve(url: str) -> Optional[str]:
resolve_fn = getattr(resolveurl, "resolve", None)
if callable(resolve_fn):
result = resolve_fn(url)
return str(result) if result else None
if result:
return str(result)
_LAST_RESOLVE_ERROR = "unresolved"
return None
except Exception as exc:
_LAST_RESOLVE_ERROR = str(exc or "")
return None