Make AnsibleError a plain ol' exception

Python's Exception constructor already takes a `message` as a parameter,
which you can then get at by doing str(e) (e.message was deprecated).

The reason I bothered to make this change was because I was debugging
with pdb and I noticed that AnsibleErrors don't give useful information
in pdb (probably because they don't have a __repr__ method that prints
the `msg` attribute).

    (Pdb) c
    > /Users/marca/dev/git-repos/ansible/lib/ansible/runner/__init__.py(599)_executor()
    -> msg = str(ae)
    (Pdb) ae
    AnsibleError()
This commit is contained in:
Marc Abramowitz
2014-11-23 18:08:10 -08:00
parent 751701c6f2
commit 372a29744b
2 changed files with 8 additions and 13 deletions

View File

@@ -17,12 +17,7 @@
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
pass
class AnsibleFileNotFound(AnsibleError):
pass