qq_lib.core.error

Exception types used throughout qq.

This module defines the core qq-specific exceptions, including recoverable errors, job-mismatch and suitability errors, and fatal or communication-related runner errors. Each exception carries an associated exit code used by qq commands to report failures consistently.

 1# Released under MIT License.
 2# Copyright (c) 2025-2026 Ladislav Bartos and Robert Vacha Lab
 3
 4"""
 5Exception types used throughout qq.
 6
 7This module defines the core qq-specific exceptions, including recoverable
 8errors, job-mismatch and suitability errors, and fatal or communication-related
 9runner errors. Each exception carries an associated exit code used by qq
10commands to report failures consistently.
11"""
12
13from qq_lib.core.config import CFG
14
15from .logger import get_logger
16
17logger = get_logger(__name__)
18
19
20class QQError(Exception):
21    """Common exception type for all recoverable qq errors."""
22
23    exit_code = CFG.exit_codes.default
24
25
26class QQJobMismatchError(QQError):
27    """Raised when the specified job ID does not match the qq info file."""
28
29    pass
30
31
32class QQNotSuitableError(QQError):
33    """Raised when a job is unsuitable for an operation."""
34
35    pass
36
37
38class QQRunFatalError(Exception):
39    """
40    Raised when qq runner is unable to load a qq info file.
41
42    Should only be used to signal that the error state cannot be logged into a qq info file.
43    """
44
45    exit_code = CFG.exit_codes.qq_run_fatal
46
47
48class QQRunCommunicationError(Exception):
49    """
50    Raised when qq runner detects an inconsistency between the information
51    it has and the information in the corresponding qq info file.
52    """
53
54    exit_code = CFG.exit_codes.qq_run_communication
logger = <Logger qq_lib.core.error (INFO)>
class QQError(builtins.Exception):
21class QQError(Exception):
22    """Common exception type for all recoverable qq errors."""
23
24    exit_code = CFG.exit_codes.default

Common exception type for all recoverable qq errors.

exit_code = 91
class QQJobMismatchError(QQError):
27class QQJobMismatchError(QQError):
28    """Raised when the specified job ID does not match the qq info file."""
29
30    pass

Raised when the specified job ID does not match the qq info file.

Inherited Members
QQError
exit_code
class QQNotSuitableError(QQError):
33class QQNotSuitableError(QQError):
34    """Raised when a job is unsuitable for an operation."""
35
36    pass

Raised when a job is unsuitable for an operation.

Inherited Members
QQError
exit_code
class QQRunFatalError(builtins.Exception):
39class QQRunFatalError(Exception):
40    """
41    Raised when qq runner is unable to load a qq info file.
42
43    Should only be used to signal that the error state cannot be logged into a qq info file.
44    """
45
46    exit_code = CFG.exit_codes.qq_run_fatal

Raised when qq runner is unable to load a qq info file.

Should only be used to signal that the error state cannot be logged into a qq info file.

exit_code = 92
class QQRunCommunicationError(builtins.Exception):
49class QQRunCommunicationError(Exception):
50    """
51    Raised when qq runner detects an inconsistency between the information
52    it has and the information in the corresponding qq info file.
53    """
54
55    exit_code = CFG.exit_codes.qq_run_communication

Raised when qq runner detects an inconsistency between the information it has and the information in the corresponding qq info file.

exit_code = 93