Skip to content

Commit 8339cf2

Browse files
bottlerfacebook-github-bot
authored andcommitted
hydra/OC.structured: don't hide error
Summary: Keep the cause of hydra errors visible in some more cases. Reviewed By: shapovalov Differential Revision: D40516202 fbshipit-source-id: 8d214be5cc808a37738add77cc305fe099788546
1 parent 9535c57 commit 8339cf2

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

pytorch3d/implicitron/tools/config.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -522,8 +522,12 @@ def get_default_args(C, *, _do_not_process: Tuple[type, ...] = ()) -> DictConfig
522522

523523
try:
524524
out: DictConfig = OmegaConf.structured(C)
525-
except Exception as e:
526-
raise ValueError(f"OmegaConf.structured({C}) failed") from e
525+
except Exception:
526+
print(f"### OmegaConf.structured({C}) failed ###")
527+
# We don't use `raise From` here, because that gets the original
528+
# exception hidden by the OC_CAUSE logic in the case where we are
529+
# called by hydra.
530+
raise
527531
exclude = getattr(C, "_processed_members", ())
528532
with open_dict(out):
529533
for field in exclude:
@@ -545,8 +549,9 @@ def get_default_args(C, *, _do_not_process: Tuple[type, ...] = ()) -> DictConfig
545549

546550
try:
547551
out: DictConfig = OmegaConf.structured(dataclass)
548-
except Exception as e:
549-
raise ValueError(f"OmegaConf.structured failed for {dataclass_name}") from e
552+
except Exception:
553+
print(f"### OmegaConf.structured failed for {C.__name__} ###")
554+
raise
550555
return out
551556

552557

0 commit comments

Comments
 (0)