Source code for SoftLayer.exceptions

"""
    SoftLayer.exceptions
    ~~~~~~~~~~~~~~~~~~~~
    Exceptions used throughout the library

    :license: MIT, see LICENSE for more details.
"""
# pylint: disable=C0103


[docs]class SoftLayerError(Exception): """The base SoftLayer error."""
[docs]class Unauthenticated(SoftLayerError): """Unauthenticated."""
[docs]class IAMError(SoftLayerError): """Errors from iam.cloud.ibm.com""" def __init__(self, fault_code, fault_string, url=None): SoftLayerError.__init__(self, fault_string) self.faultCode = fault_code self.faultString = fault_string self.url = url def __repr__(self): return "{} ({}): {}".format(self.url, self.faultCode, self.faultString) def __str__(self): return "{} ({}): {}".format(self.url, self.faultCode, self.faultString)
[docs]class SoftLayerAPIError(SoftLayerError): """SoftLayerAPIError is an exception raised during API errors. Provides faultCode and faultString properties. """ def __init__(self, fault_code, fault_string, *args): SoftLayerError.__init__(self, fault_string, *args) self.faultCode = fault_code self.reason = self.faultString = fault_string def __repr__(self): return '<%s(%s): %s>' % (self.__class__.__name__, self.faultCode, self.faultString) def __str__(self): return '%s(%s): %s' % (self.__class__.__name__, self.faultCode, self.faultString)
[docs]class ParseError(SoftLayerAPIError): """Parse Error."""
[docs]class ServerError(SoftLayerAPIError): """Server Error."""
[docs]class ApplicationError(SoftLayerAPIError): """Application Error."""
[docs]class RemoteSystemError(SoftLayerAPIError): """System Error."""
[docs]class TransportError(SoftLayerAPIError): """Transport Error."""
# XMLRPC Errors
[docs]class NotWellFormed(ParseError): """Request was not well formed."""
[docs]class UnsupportedEncoding(ParseError): """Encoding not supported."""
[docs]class InvalidCharacter(ParseError): """There was an invalid character."""
[docs]class SpecViolation(ServerError): """There was a spec violation."""
[docs]class MethodNotFound(SoftLayerAPIError): """Method name not found."""
[docs]class InvalidMethodParameters(SoftLayerAPIError): """Invalid method paramters."""
[docs]class InternalError(ServerError): """Internal Server Error."""