potiuk commented on code in PR #68890:
URL: https://github.com/apache/airflow/pull/68890#discussion_r3681863120
##########
airflow-core/src/airflow/utils/helpers.py:
##########
@@ -55,16 +55,14 @@ def validate_key(k: str, max_length: int = 250):
if not isinstance(k, str):
raise TypeError(f"The key has to be a string and is {type(k)}:{k}")
if len(k) > max_length:
- raise AirflowException(f"The key: {k} has to be less than {max_length}
characters")
+ raise ValueError(f"The key: {k} has to be less than {max_length}
characters")
Review Comment:
Worth noting the two copies of this function have now drifted in a small
way: the SDK version raises `"The key has to be less than {max_length}
characters, not {length}"` while this one keeps `"The key: {k} has to be less
than {max_length} characters"` — which interpolates the whole offending key
into the message (for the 251-space test case, that's 251 characters of
whitespace in the error).
Not something this PR has to fix, but since the point is bringing the two
into alignment, matching the SDK's wording here would finish the job and give a
more readable message.
---
Drafted-by: Claude Code (Opus 5); reviewed by @potiuk before posting
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]