Skip to content

Module pyastrobee.utils.errors

Custom exceptions

View Source
"""Custom exceptions"""

from typing import Optional

class PybulletError(Exception):

    """Custom exception type for dealing with Pybullet-related issues

    Args:

        message (str): Info to display about the error

        code (int, optional): A pybullet return value indicating that an error occurred. Defaults to None.

    """

    def __init__(self, message: str, code: Optional[int] = None):

        # Store as class attribute to access the code and handle programmatically if needed

        self.code = code

        if code is not None:

            message += f"\nPybullet return value: {code}"

        super().__init__(message)

class OptimizationError(Exception):

    pass

Classes

OptimizationError

class OptimizationError(
    /,
    *args,
    **kwargs
)

Common base class for all non-exit exceptions.

View Source
class OptimizationError(Exception):

    pass

Ancestors (in MRO)

  • builtins.Exception
  • builtins.BaseException

Class variables

args

Methods

with_traceback

def with_traceback(
    ...
)

Exception.with_traceback(tb) --

set self.traceback to tb and return self.

PybulletError

class PybulletError(
    message: str,
    code: Optional[int] = None
)

Custom exception type for dealing with Pybullet-related issues

Attributes

Name Type Description Default
message str Info to display about the error None
code int A pybullet return value indicating that an error occurred. Defaults to None. None
View Source
class PybulletError(Exception):

    """Custom exception type for dealing with Pybullet-related issues

    Args:

        message (str): Info to display about the error

        code (int, optional): A pybullet return value indicating that an error occurred. Defaults to None.

    """

    def __init__(self, message: str, code: Optional[int] = None):

        # Store as class attribute to access the code and handle programmatically if needed

        self.code = code

        if code is not None:

            message += f"\nPybullet return value: {code}"

        super().__init__(message)

Ancestors (in MRO)

  • builtins.Exception
  • builtins.BaseException

Class variables

args

Methods

with_traceback

def with_traceback(
    ...
)

Exception.with_traceback(tb) --

set self.traceback to tb and return self.