mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-26 14:41:23 -07:00
Upgrades to error handling, now general try/catch available.
This commit is contained in:
parent
2e1b59a9d2
commit
4ae98ed92d
5 changed files with 92 additions and 52 deletions
|
@ -20,18 +20,18 @@ class AnsibleError(Exception):
|
|||
"""
|
||||
The base Ansible exception from which all others should subclass.
|
||||
"""
|
||||
|
||||
def __init__(self, msg):
|
||||
self.msg = msg
|
||||
|
||||
def __str__(self):
|
||||
return self.msg
|
||||
|
||||
|
||||
class AnsibleFileNotFound(AnsibleError):
|
||||
pass
|
||||
|
||||
class AnsibleConnectionFailed(AnsibleError):
|
||||
pass
|
||||
|
||||
|
||||
class AnsibleInventoryNotFoundError(AnsibleError):
|
||||
"""
|
||||
Exception raised when the default or provided host inventory file
|
||||
does not exist.
|
||||
"""
|
||||
def __init__(self, inventory):
|
||||
self.inventory = inventory
|
||||
self.msg = "Unable to continue, inventory file not found: %s" %\
|
||||
self.inventory
|
||||
|
||||
def __str__(self):
|
||||
return self.msg
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue