fix: surface clear error when dotted-path provider needs ctor args

This commit is contained in:
Greyson LaLonde
2026-05-21 02:26:57 +08:00
parent 163b3b592d
commit dc047743b8

View File

@@ -204,4 +204,11 @@ def _dotted_path_to_instance(value: Any) -> Any:
f"Invalid provider path {value!r}: expected a class, got "
f"{type(cls).__name__}"
)
return cls()
try:
return cls()
except TypeError as exc:
raise ValueError(
f"Cannot reinstantiate {value!r} with no arguments: {exc}. "
"Only no-arg constructors are checkpointable; rebuild the "
"instance manually and assign it after restore."
) from exc