dev: harden resolver bootstrap and simplify update settings
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user