Skip to content

Module scrapli.exceptions

scrapli.exceptions

Expand source code
        
"""scrapli.exceptions"""
from typing import Optional


class ScrapliException(Exception):
    """Base Exception for all scrapli exceptions"""


class ScrapliModuleNotFound(ScrapliException):
    """ModuleNotFound but for scrapli related issues"""


class ScrapliTypeError(ScrapliException):
    """TypeError but for scrapli related typing issues"""


class ScrapliValueError(ScrapliException):
    """ValueError but for scrapli related value issues"""


class ScrapliUnsupportedPlatform(ScrapliException):
    """Exception for unsupported platform; i.e. using system transport on windows"""


class ScrapliTransportPluginError(ScrapliException):
    """Exception for transport plugin issues"""


class ScrapliConnectionNotOpened(ScrapliException):
    """Exception for trying to operate on a transport which has not been opened"""

    def __init__(
        self,
        message: Optional[str] = None,
    ) -> None:
        """
        Scrapli connection not opened exception

        Args:
            message: optional message

        Returns:
            None

        Raises:
            N/A

        """
        if not message:
            self.message = (
                "connection not opened, but attempting to call a method that requires an open "
                "connection, do you need to call 'open()'?"
            )
        else:
            self.message = message
        super().__init__(self.message)


class ScrapliAuthenticationFailed(ScrapliException):
    """Exception for scrapli authentication issues"""


class ScrapliConnectionError(ScrapliException):
    """Exception for underlying connection issues"""


class ScrapliTimeout(ScrapliException):
    """Exception for any scrapli timeouts"""


class ScrapliCommandFailure(ScrapliException):
    """Exception for scrapli command/config failures"""


class ScrapliPrivilegeError(ScrapliException):
    """Exception for all privilege related scrapli issues"""
        
    

Classes

ScrapliAuthenticationFailed

1
Exception for scrapli authentication issues
Expand source code
        
class ScrapliAuthenticationFailed(ScrapliException):
    """Exception for scrapli authentication issues"""
        
    

Ancestors (in MRO)

  • scrapli.exceptions.ScrapliException
  • builtins.Exception
  • builtins.BaseException

ScrapliCommandFailure

1
Exception for scrapli command/config failures
Expand source code
        
class ScrapliCommandFailure(ScrapliException):
    """Exception for scrapli command/config failures"""
        
    

Ancestors (in MRO)

  • scrapli.exceptions.ScrapliException
  • builtins.Exception
  • builtins.BaseException

ScrapliConnectionError

1
Exception for underlying connection issues
Expand source code
        
class ScrapliConnectionError(ScrapliException):
    """Exception for underlying connection issues"""
        
    

Ancestors (in MRO)

  • scrapli.exceptions.ScrapliException
  • builtins.Exception
  • builtins.BaseException

ScrapliConnectionNotOpened

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
Exception for trying to operate on a transport which has not been opened

Scrapli connection not opened exception

Args:
    message: optional message

Returns:
    None

Raises:
    N/A
Expand source code
        
class ScrapliConnectionNotOpened(ScrapliException):
    """Exception for trying to operate on a transport which has not been opened"""

    def __init__(
        self,
        message: Optional[str] = None,
    ) -> None:
        """
        Scrapli connection not opened exception

        Args:
            message: optional message

        Returns:
            None

        Raises:
            N/A

        """
        if not message:
            self.message = (
                "connection not opened, but attempting to call a method that requires an open "
                "connection, do you need to call 'open()'?"
            )
        else:
            self.message = message
        super().__init__(self.message)
        
    

Ancestors (in MRO)

  • scrapli.exceptions.ScrapliException
  • builtins.Exception
  • builtins.BaseException

ScrapliException

1
Base Exception for all scrapli exceptions
Expand source code
        
class ScrapliException(Exception):
    """Base Exception for all scrapli exceptions"""
        
    

Ancestors (in MRO)

  • builtins.Exception
  • builtins.BaseException

Descendants

  • scrapli.exceptions.ScrapliAuthenticationFailed
  • scrapli.exceptions.ScrapliCommandFailure
  • scrapli.exceptions.ScrapliConnectionError
  • scrapli.exceptions.ScrapliConnectionNotOpened
  • scrapli.exceptions.ScrapliModuleNotFound
  • scrapli.exceptions.ScrapliPrivilegeError
  • scrapli.exceptions.ScrapliTimeout
  • scrapli.exceptions.ScrapliTransportPluginError
  • scrapli.exceptions.ScrapliTypeError
  • scrapli.exceptions.ScrapliUnsupportedPlatform
  • scrapli.exceptions.ScrapliValueError

ScrapliModuleNotFound

1
ModuleNotFound but for scrapli related issues
Expand source code
        
class ScrapliModuleNotFound(ScrapliException):
    """ModuleNotFound but for scrapli related issues"""
        
    

Ancestors (in MRO)

  • scrapli.exceptions.ScrapliException
  • builtins.Exception
  • builtins.BaseException

ScrapliPrivilegeError

1
Exception for all privilege related scrapli issues
Expand source code
        
class ScrapliPrivilegeError(ScrapliException):
    """Exception for all privilege related scrapli issues"""
        
    

Ancestors (in MRO)

  • scrapli.exceptions.ScrapliException
  • builtins.Exception
  • builtins.BaseException

ScrapliTimeout

1
Exception for any scrapli timeouts
Expand source code
        
class ScrapliTimeout(ScrapliException):
    """Exception for any scrapli timeouts"""
        
    

Ancestors (in MRO)

  • scrapli.exceptions.ScrapliException
  • builtins.Exception
  • builtins.BaseException

ScrapliTransportPluginError

1
Exception for transport plugin issues
Expand source code
        
class ScrapliTransportPluginError(ScrapliException):
    """Exception for transport plugin issues"""
        
    

Ancestors (in MRO)

  • scrapli.exceptions.ScrapliException
  • builtins.Exception
  • builtins.BaseException

ScrapliTypeError

1
TypeError but for scrapli related typing issues
Expand source code
        
class ScrapliTypeError(ScrapliException):
    """TypeError but for scrapli related typing issues"""
        
    

Ancestors (in MRO)

  • scrapli.exceptions.ScrapliException
  • builtins.Exception
  • builtins.BaseException

ScrapliUnsupportedPlatform

1
Exception for unsupported platform; i.e. using system transport on windows
Expand source code
        
class ScrapliUnsupportedPlatform(ScrapliException):
    """Exception for unsupported platform; i.e. using system transport on windows"""
        
    

Ancestors (in MRO)

  • scrapli.exceptions.ScrapliException
  • builtins.Exception
  • builtins.BaseException

ScrapliValueError

1
ValueError but for scrapli related value issues
Expand source code
        
class ScrapliValueError(ScrapliException):
    """ValueError but for scrapli related value issues"""
        
    

Ancestors (in MRO)

  • scrapli.exceptions.ScrapliException
  • builtins.Exception
  • builtins.BaseException