1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

change raising errors example to raise error (#43664)

Example instantiates an AnsibleError which derives from Exception but doesn't actually raise it like intended. This is misleading as it's not clear without examining the code for AnsibleError to know that it's not some function which would raise the exception automatically.
This commit is contained in:
Will Smith 2018-08-06 02:27:55 -07:00 committed by Abhijeet Kasurde
parent 741fa025a0
commit 2de692348f

View file

@ -26,7 +26,7 @@ In general, errors encountered during execution should be returned by raising An
try:
cause_an_exception()
except Exception as e:
AnsibleError('Something happened, this was original exception: %s' % to_native(e))
raise AnsibleError('Something happened, this was original exception: %s' % to_native(e))
Check the different AnsibleError objects and see which one applies the best to your situation.