Use raise from in plugins (#11095)

* Use raise from.

* Add changelog fragment.
This commit is contained in:
Felix Fontein
2025-11-12 20:34:26 +01:00
committed by GitHub
parent 1a82e93c6d
commit 2b4333a033
46 changed files with 218 additions and 165 deletions

View File

@@ -37,7 +37,7 @@ def initialize_hashids(**kwargs):
raise AnsibleFilterError(
"The provided parameters %s are invalid: %s"
% (", ".join(["%s=%s" % (k, v) for k, v in params.items()]), to_native(e))
)
) from e
def hashids_encode(nums, salt=None, alphabet=None, min_length=None):
@@ -60,7 +60,7 @@ def hashids_encode(nums, salt=None, alphabet=None, min_length=None):
try:
hashid = hashids.encode(*nums)
except TypeError as e:
raise AnsibleTypeError(f"Data to encode must by a tuple or list of ints: {e}")
raise AnsibleTypeError(f"Data to encode must by a tuple or list of ints: {e}") from e
return hashid