Module moody.exceptions

Expand source code
#!/usr/bin/env python
# --------------------------------------------------------------------
# Copyright (c) iEXBase. All rights reserved.
# Licensed under the MIT License.
# See License.txt in the project root for license information.
# --------------------------------------------------------------------


class EvmError(Exception):
    """Base class for TronAPI exceptions."""


class InvalidEvmError(EvmError):
    """Raised Tron Error"""


class FoundUndeployedLibraries(Exception):
    """
    there is an undeployed library in the bin file
    """
    pass


class FallbackNotFound(Exception):
    """
    Raised when fallback function doesn't exist in contract.
    """
    pass


class MismatchedABI(Exception):
    """
    Raised when an ABI does not match with supplied parameters, or when an
    attempt is made to access a function/event that does not exist in the ABI.
    """
    pass


class InvalidAddress(ValueError):
    """
    The supplied address does not have a valid checksum, as defined in EIP-55
    """
    pass


class NoABIFunctionsFound(AttributeError):
    """
    Raised when an ABI doesn't contain any functions.
    """
    pass


class LoopError(Exception):
    """
    Error raised from service loop.
    """
    pass


class ValidationError(Exception):
    """
    Raised when a supplied value is invalid.
    """
    pass


class TransportError(EvmError):
    """Base exception for transport related errors.

    This is mainly for cases where the status code denotes an HTTP error, and
    for cases in which there was a connection error.

    """

    @property
    def status_code(self):
        return self.args[0]

    @property
    def error(self):
        return self.args[1]

    @property
    def info(self):
        return self.args[2]

    @property
    def url(self):
        return self.args[3]


class HttpError(TransportError):
    """Exception for errors occurring when connecting, and/or making a request"""


class BadRequest(TransportError):
    """Exception for HTTP 400 errors."""


class NotFoundError(TransportError):
    """Exception for HTTP 404 errors."""


class TransactionError(Exception):
    pass


class ServiceUnavailable(TransportError):
    """Exception for HTTP 503 errors."""


class GatewayTimeout(TransportError):
    """Exception for HTTP 503 errors."""


class TimeExhausted(Exception):
    """
    Raised when a method has not retrieved the desired result within a specified timeout.
    """
    pass


class BadAddress(ValueError):
    """
    The address is not tron specified address
    """
    pass


class BadKey(ValueError):
    pass


class BadSignature(ValueError):
    pass


class BadHash(ValueError):
    pass


class TaposError(ValueError):
    pass


class UnknownError(Exception):
    pass


class TvmError(Exception):
    pass


class ApiError(Exception):
    pass


class AddressNotFound(NotFoundError):
    pass


class TransactionNotFound(NotFoundError):
    pass


class BlockNotFound(NotFoundError):
    pass


class AssetNotFound(NotFoundError):
    pass


class DoubleSpending(TransactionError):
    pass


HTTP_EXCEPTIONS = {
    400: BadRequest,
    404: NotFoundError,
    503: ServiceUnavailable,
    504: GatewayTimeout,
}

Classes

class AddressNotFound (*args, **kwargs)

Exception for HTTP 404 errors.

Expand source code
class AddressNotFound(NotFoundError):
    pass

Ancestors

class ApiError (*args, **kwargs)

Common base class for all non-exit exceptions.

Expand source code
class ApiError(Exception):
    pass

Ancestors

  • builtins.Exception
  • builtins.BaseException
class AssetNotFound (*args, **kwargs)

Exception for HTTP 404 errors.

Expand source code
class AssetNotFound(NotFoundError):
    pass

Ancestors

class BadAddress (*args, **kwargs)

The address is not tron specified address

Expand source code
class BadAddress(ValueError):
    """
    The address is not tron specified address
    """
    pass

Ancestors

  • builtins.ValueError
  • builtins.Exception
  • builtins.BaseException
class BadHash (*args, **kwargs)

Inappropriate argument value (of correct type).

Expand source code
class BadHash(ValueError):
    pass

Ancestors

  • builtins.ValueError
  • builtins.Exception
  • builtins.BaseException
class BadKey (*args, **kwargs)

Inappropriate argument value (of correct type).

Expand source code
class BadKey(ValueError):
    pass

Ancestors

  • builtins.ValueError
  • builtins.Exception
  • builtins.BaseException
class BadRequest (*args, **kwargs)

Exception for HTTP 400 errors.

Expand source code
class BadRequest(TransportError):
    """Exception for HTTP 400 errors."""

Ancestors

class BadSignature (*args, **kwargs)

Inappropriate argument value (of correct type).

Expand source code
class BadSignature(ValueError):
    pass

Ancestors

  • builtins.ValueError
  • builtins.Exception
  • builtins.BaseException
class BlockNotFound (*args, **kwargs)

Exception for HTTP 404 errors.

Expand source code
class BlockNotFound(NotFoundError):
    pass

Ancestors

class DoubleSpending (*args, **kwargs)

Common base class for all non-exit exceptions.

Expand source code
class DoubleSpending(TransactionError):
    pass

Ancestors

class EvmError (*args, **kwargs)

Base class for TronAPI exceptions.

Expand source code
class EvmError(Exception):
    """Base class for TronAPI exceptions."""

Ancestors

  • builtins.Exception
  • builtins.BaseException

Subclasses

class FallbackNotFound (*args, **kwargs)

Raised when fallback function doesn't exist in contract.

Expand source code
class FallbackNotFound(Exception):
    """
    Raised when fallback function doesn't exist in contract.
    """
    pass

Ancestors

  • builtins.Exception
  • builtins.BaseException
class FoundUndeployedLibraries (*args, **kwargs)

there is an undeployed library in the bin file

Expand source code
class FoundUndeployedLibraries(Exception):
    """
    there is an undeployed library in the bin file
    """
    pass

Ancestors

  • builtins.Exception
  • builtins.BaseException
class GatewayTimeout (*args, **kwargs)

Exception for HTTP 503 errors.

Expand source code
class GatewayTimeout(TransportError):
    """Exception for HTTP 503 errors."""

Ancestors

class HttpError (*args, **kwargs)

Exception for errors occurring when connecting, and/or making a request

Expand source code
class HttpError(TransportError):
    """Exception for errors occurring when connecting, and/or making a request"""

Ancestors

class InvalidAddress (*args, **kwargs)

The supplied address does not have a valid checksum, as defined in EIP-55

Expand source code
class InvalidAddress(ValueError):
    """
    The supplied address does not have a valid checksum, as defined in EIP-55
    """
    pass

Ancestors

  • builtins.ValueError
  • builtins.Exception
  • builtins.BaseException
class InvalidEvmError (*args, **kwargs)

Raised Tron Error

Expand source code
class InvalidEvmError(EvmError):
    """Raised Tron Error"""

Ancestors

  • EvmError
  • builtins.Exception
  • builtins.BaseException
class LoopError (*args, **kwargs)

Error raised from service loop.

Expand source code
class LoopError(Exception):
    """
    Error raised from service loop.
    """
    pass

Ancestors

  • builtins.Exception
  • builtins.BaseException
class MismatchedABI (*args, **kwargs)

Raised when an ABI does not match with supplied parameters, or when an attempt is made to access a function/event that does not exist in the ABI.

Expand source code
class MismatchedABI(Exception):
    """
    Raised when an ABI does not match with supplied parameters, or when an
    attempt is made to access a function/event that does not exist in the ABI.
    """
    pass

Ancestors

  • builtins.Exception
  • builtins.BaseException
class NoABIFunctionsFound (*args, **kwargs)

Raised when an ABI doesn't contain any functions.

Expand source code
class NoABIFunctionsFound(AttributeError):
    """
    Raised when an ABI doesn't contain any functions.
    """
    pass

Ancestors

  • builtins.AttributeError
  • builtins.Exception
  • builtins.BaseException
class NotFoundError (*args, **kwargs)

Exception for HTTP 404 errors.

Expand source code
class NotFoundError(TransportError):
    """Exception for HTTP 404 errors."""

Ancestors

Subclasses

class ServiceUnavailable (*args, **kwargs)

Exception for HTTP 503 errors.

Expand source code
class ServiceUnavailable(TransportError):
    """Exception for HTTP 503 errors."""

Ancestors

class TaposError (*args, **kwargs)

Inappropriate argument value (of correct type).

Expand source code
class TaposError(ValueError):
    pass

Ancestors

  • builtins.ValueError
  • builtins.Exception
  • builtins.BaseException
class TimeExhausted (*args, **kwargs)

Raised when a method has not retrieved the desired result within a specified timeout.

Expand source code
class TimeExhausted(Exception):
    """
    Raised when a method has not retrieved the desired result within a specified timeout.
    """
    pass

Ancestors

  • builtins.Exception
  • builtins.BaseException
class TransactionError (*args, **kwargs)

Common base class for all non-exit exceptions.

Expand source code
class TransactionError(Exception):
    pass

Ancestors

  • builtins.Exception
  • builtins.BaseException

Subclasses

class TransactionNotFound (*args, **kwargs)

Exception for HTTP 404 errors.

Expand source code
class TransactionNotFound(NotFoundError):
    pass

Ancestors

class TransportError (*args, **kwargs)

Base exception for transport related errors.

This is mainly for cases where the status code denotes an HTTP error, and for cases in which there was a connection error.

Expand source code
class TransportError(EvmError):
    """Base exception for transport related errors.

    This is mainly for cases where the status code denotes an HTTP error, and
    for cases in which there was a connection error.

    """

    @property
    def status_code(self):
        return self.args[0]

    @property
    def error(self):
        return self.args[1]

    @property
    def info(self):
        return self.args[2]

    @property
    def url(self):
        return self.args[3]

Ancestors

  • EvmError
  • builtins.Exception
  • builtins.BaseException

Subclasses

Instance variables

var error
Expand source code
@property
def error(self):
    return self.args[1]
var info
Expand source code
@property
def info(self):
    return self.args[2]
var status_code
Expand source code
@property
def status_code(self):
    return self.args[0]
var url
Expand source code
@property
def url(self):
    return self.args[3]
class TvmError (*args, **kwargs)

Common base class for all non-exit exceptions.

Expand source code
class TvmError(Exception):
    pass

Ancestors

  • builtins.Exception
  • builtins.BaseException
class UnknownError (*args, **kwargs)

Common base class for all non-exit exceptions.

Expand source code
class UnknownError(Exception):
    pass

Ancestors

  • builtins.Exception
  • builtins.BaseException
class ValidationError (*args, **kwargs)

Raised when a supplied value is invalid.

Expand source code
class ValidationError(Exception):
    """
    Raised when a supplied value is invalid.
    """
    pass

Ancestors

  • builtins.Exception
  • builtins.BaseException