refactor(list_operator): replace ValueError with InvalidKeyError (#10222)

This commit is contained in:
-LAN- 2024-11-04 15:23:08 +08:00 committed by GitHub
parent 38bca6731c
commit 9369cc44e6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -295,4 +295,4 @@ def _order_file(*, order: Literal["asc", "desc"], order_by: str = "", array: Seq
extract_func = _get_file_extract_number_func(key=order_by) extract_func = _get_file_extract_number_func(key=order_by)
return sorted(array, key=lambda x: extract_func(x), reverse=order == "desc") return sorted(array, key=lambda x: extract_func(x), reverse=order == "desc")
else: else:
raise ValueError(f"Invalid order key: {order_by}") raise InvalidKeyError(f"Invalid order key: {order_by}")