From 5b15c9fa40da1b34dabde30ef3d0c8ed2623cacb Mon Sep 17 00:00:00 2001 From: Dowon Date: Fri, 29 Mar 2024 21:35:09 +0900 Subject: [PATCH] fix: reduce validation error message --- scripts/!adetailer.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/scripts/!adetailer.py b/scripts/!adetailer.py index 09c52b8..c8cdb66 100644 --- a/scripts/!adetailer.py +++ b/scripts/!adetailer.py @@ -267,15 +267,12 @@ class AfterDetailerScript(scripts.Script): try: inp = ADetailerArgs(**arg_dict) except ValueError as e: - msgs = [ - f"[-] ADetailer: ValidationError when validating {ordinal(n)} arguments: {e}\n" - ] - for attr in ALL_ARGS.attrs: - arg = arg_dict.get(attr) - dtype = type(arg) - arg = "DEFAULT" if arg is None else repr(arg) - msgs.append(f" {attr}: {arg} ({dtype})") - raise ValueError("\n".join(msgs)) from e + msg = f"[-] ADetailer: ValidationError when validating {ordinal(n)} arguments" + if hasattr(e, "add_note"): + e.add_note(msg) + else: + print(msg, file=sys.stderr) + raise all_inputs.append(inp)