mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
Use raise from in plugins (#11095)
* Use raise from. * Add changelog fragment.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user