Error Class Documentation

Custom exception hierarchy for the bedrock_server_manager package.

This module defines a simplified and structured set of exceptions. The design prioritizes clarity, reduces redundancy, and integrates properly with Python’s built-in exception types.

Key Principles:
  • A single base exception, BSMError, for all application errors.

  • A clear hierarchy with logical categories (e.g., FileError, ServerError).

  • Inheritance from standard Python exceptions (e.g., ValueError, FileNotFoundError) to allow for flexible and standard exception handling.

All custom exceptions inherit from BSMError.

exception bedrock_server_manager.error.BSMError

Bases: Exception

Base class for all custom exceptions in this project.

exception bedrock_server_manager.error.FileError

Bases: BSMError

Base for errors related to file or directory operations.

exception bedrock_server_manager.error.ServerError

Bases: BSMError

Base for errors related to managing the Bedrock server process.

exception bedrock_server_manager.error.ConfigurationError

Bases: BSMError

Base for errors related to configuration files or values.

exception bedrock_server_manager.error.SystemError

Bases: BSMError

Base for errors related to interactions with the host operating system.

exception bedrock_server_manager.error.NetworkError

Bases: BSMError

Base for errors related to network connectivity.

exception bedrock_server_manager.error.UserInputError

Bases: BSMError, ValueError

Base for errors caused by invalid user input. Inherits from ValueError for broader compatibility.

exception bedrock_server_manager.error.AppFileNotFoundError(path: str, description: str = 'Required file or directory')

Bases: FileError, FileNotFoundError

Raised when an essential application file or directory is not found. Inherits from FileNotFoundError for standard exception handling.

exception bedrock_server_manager.error.FileOperationError

Bases: FileError

Raised for general failures during file operations like copy, move, or delete.

exception bedrock_server_manager.error.DownloadError

Bases: FileError, OSError

Raised when downloading a file fails. Inherits from IOError.

exception bedrock_server_manager.error.ExtractError

Bases: FileError

Raised when extracting an archive (zip, etc.) fails.

exception bedrock_server_manager.error.BackupRestoreError

Bases: FileOperationError

Raised when a backup or restore operation fails.

exception bedrock_server_manager.error.ServerProcessError

Bases: ServerError

Base for errors in starting, stopping, or checking the server process.

exception bedrock_server_manager.error.ServerStartError

Bases: ServerProcessError

Raised when the server process fails to start.

exception bedrock_server_manager.error.ServerStopError

Bases: ServerProcessError

Raised when the server process fails to stop.

exception bedrock_server_manager.error.ServerNotRunningError

Bases: ServerProcessError

Raised when an operation requires the server to be running, but it’s not.

exception bedrock_server_manager.error.SendCommandError

Bases: ServerError

Raised when sending a command to the server console fails.

exception bedrock_server_manager.error.ConfigParseError

Bases: ConfigurationError, ValueError

Raised when a configuration file is malformed or contains invalid values. Inherits from ValueError for standard exception handling.

exception bedrock_server_manager.error.BlockedCommandError

Bases: ConfigParseError

Raised when an attempt is made to send a command blocked by configuration.

exception bedrock_server_manager.error.PermissionsError

Bases: SystemError, PermissionError

Raised for OS-level file or directory permission errors. Inherits from PermissionError for standard exception handling.

exception bedrock_server_manager.error.CommandNotFoundError(command_name: str, message='System command not found')

Bases: SystemError

Raised when a required system command (e.g., ‘systemctl’, ‘unzip’) is not found.

exception bedrock_server_manager.error.InternetConnectivityError

Bases: NetworkError

Raised when an operation requires internet access, but it’s unavailable.

exception bedrock_server_manager.error.MissingArgumentError

Bases: UserInputError

Raised when a required function or command-line argument is missing.

exception bedrock_server_manager.error.InvalidServerNameError

Bases: UserInputError

Raised when a provided server name is invalid or contains illegal characters.