Source code for panos.errors

#!/usr/bin/env python

# Copyright (c) 2014, Palo Alto Networks
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.


"""Exception classes used by pan-os-python package"""

from pan.xapi import PanXapiError


# Exceptions used by PanDevice Class
[docs]class PanDeviceError(PanXapiError): """Exception for errors in the PanDevice class The PanDevice class may raise errors when problems occur such as response parsing problems. This exception class is raised on those errors. This class is not for errors connecting to the API, as pan.xapi.PanXapiError is responsible for those. Attributes: message: The error message for the exception pan_device: A reference to the PanDevice that generated the exception """ def __init__(self, *args, **kwargs): self.pan_device = kwargs.pop("pan_device", None) super(PanDeviceError, self).__init__(*args, **kwargs) self.message = "{0}".format(self)
[docs]class PanDeviceXapiError(PanDeviceError): """General error returned by an API call""" pass
[docs]class PanInvalidCredentials(PanDeviceXapiError): pass
[docs]class PanURLError(PanDeviceXapiError): pass
[docs]class PanConnectionTimeout(PanDeviceXapiError): pass
[docs]class PanJobTimeout(PanDeviceError): pass
[docs]class PanLockError(PanDeviceError): pass
[docs]class PanPendingChanges(PanDeviceError): pass
[docs]class PanCommitInProgress(PanDeviceXapiError): pass
[docs]class PanInstallInProgress(PanDeviceXapiError): pass
[docs]class PanCommitFailed(PanDeviceXapiError): def __init__(self, *args, **kwargs): self.result = kwargs.pop("result", None) super(PanCommitFailed, self).__init__("Commit failed", *args, **kwargs)
[docs]class PanCommitNotNeeded(PanDeviceXapiError): pass
[docs]class PanSessionTimedOut(PanDeviceXapiError): pass
[docs]class PanDeviceNotSet(PanDeviceError): pass
[docs]class PanNotConnectedOnPanorama(PanDeviceError): pass
[docs]class PanNotAttachedOnPanorama(PanDeviceError): pass
[docs]class PanNoSuchNode(PanDeviceXapiError): pass
[docs]class PanObjectMissing(PanDeviceXapiError): pass
[docs]class PanHAConfigSyncFailed(PanDeviceXapiError): pass
[docs]class PanHASyncInProgress(PanDeviceXapiError): pass
[docs]class PanObjectError(PanDeviceError): pass
[docs]class PanApiKeyNotSet(PanDeviceError): pass
[docs]class PanActivateFeatureAuthCodeError(PanDeviceError): pass
[docs]class PanOutdatedSslError(PanDeviceError): pass