mirror of
https://github.com/ansible/awx.git
synced 2026-05-19 23:07:42 -02:30
import awxkit
Co-authored-by: Christopher Wang <cwang@ansible.com> Co-authored-by: Jake McDermott <jmcdermott@ansible.com> Co-authored-by: Jim Ladd <jladd@redhat.com> Co-authored-by: Elijah DeLee <kdelee@redhat.com> Co-authored-by: Alan Rominger <arominge@redhat.com> Co-authored-by: Yanis Guenane <yanis@guenane.org>
This commit is contained in:
98
awxkit/awxkit/exceptions.py
Normal file
98
awxkit/awxkit/exceptions.py
Normal file
@@ -0,0 +1,98 @@
|
||||
|
||||
class Common(Exception):
|
||||
|
||||
def __init__(self, status_string='', message=''):
|
||||
if isinstance(status_string, Exception):
|
||||
self.status_string = ''
|
||||
return super(Common, self).__init__(*status_string)
|
||||
self.status_string = status_string
|
||||
self.msg = message
|
||||
|
||||
def __getitem__(self, val):
|
||||
return (self.status_string, self.msg)[val]
|
||||
|
||||
def __repr__(self):
|
||||
return self.__str__()
|
||||
|
||||
def __str__(self):
|
||||
return str(self.msg)
|
||||
|
||||
|
||||
class BadRequest(Common):
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class Conflict(Common):
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class Duplicate(Common):
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class Forbidden(Common):
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class InternalServerError(Common):
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class BadGateway(Common):
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class LicenseExceeded(Common):
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class LicenseInvalid(Common):
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class MethodNotAllowed(Common):
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class NoContent(Common):
|
||||
|
||||
message = ''
|
||||
|
||||
|
||||
class NotFound(Common):
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class PaymentRequired(Common):
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class Unauthorized(Common):
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class Unknown(Common):
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class WaitUntilTimeout(Common):
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class UnexpectedAWXState(Common):
|
||||
|
||||
pass
|
||||
Reference in New Issue
Block a user