Skip to content

Exceptions

JobException

Bases: Exception

Exception raised when an error occurred while processing a job

Source code in src/mmisp/worker/exceptions/job_exceptions.py
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
class JobException(Exception):
    """
    Exception raised when an error occurred while processing a job
    """

    def __init__(
        self: Self, job_id: str | None = None, message: str = "An error occurred while processing the Job"
    ) -> None:
        self.message: str
        if job_id:
            self.message = f"An error occurred while processing the Job with id: {job_id}"
        else:
            self.message = message
        super().__init__(self.message)

JobHasNoResultException

Bases: Exception

Exception raised when a requested job has no result that can be returned

Source code in src/mmisp/worker/exceptions/job_exceptions.py
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
class JobHasNoResultException(Exception):
    """
    Exception raised when a requested job has no result that can be returned
    """

    def __init__(
        self: Self,
        job_id: str | None = None,
        job_type: str | None = None,
        message: str = "The requestet Jobtype has no result that can be returned",
    ) -> None:
        self.message: str
        if job_id is None and job_type is None:
            self.message = message
        elif job_id is None:
            self.message = f"The requested Job of type {job_type} has no result that can be returned"
        elif job_type is None:
            self.message = f"The requested Job with id: {job_id} has no result that can be returned"
        else:
            self.message = (
                f"The requested Job with id: {job_id} is of type {job_type}, which has no result that can be returned"
            )
        super().__init__(self.message)

JobNotFinishedException

Bases: Exception

Exception raised when a requested job is not finished yet

Source code in src/mmisp/worker/exceptions/job_exceptions.py
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
class JobNotFinishedException(Exception):
    """
    Exception raised when a requested job is not finished yet
    """

    def __init__(
        self: Self, job_id: str | None = None, message: str = "The Job is not finished yet, please try again later"
    ) -> None:
        self.message: str
        if job_id is None:
            self.message = message
        else:
            self.message = f"The Job with id: {job_id} is not finished yet, please try again later"

        super().__init__(self.message)

NotExistentJobException

Bases: Exception

Exception raised when a requested job does not exist

Source code in src/mmisp/worker/exceptions/job_exceptions.py
20
21
22
23
24
25
26
27
28
29
30
31
class NotExistentJobException(Exception):
    """
    Exception raised when a requested job does not exist
    """

    def __init__(self: Self, job_id: str | None = None, message: str = "The requested Job does not exist") -> None:
        self.message: str
        if job_id is None:
            self.message = message
        else:
            self.message = f"The requested job with id: {job_id} does not exist"
        super().__init__(self.message)

EnvVariableNotFound

Bases: Exception

Exception raised when an environment variable is not found

Source code in src/mmisp/worker/exceptions/environment_exceptions.py
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
class EnvVariableNotFound(Exception):
    """
    Exception raised when an environment variable is not found
    """

    def __init__(
        self: Self, env_var: str | None = None, message: str = "A requested environment variable was not found"
    ) -> None:
        self.message: str
        if env_var is None:
            self.message = message
        else:
            self.message = f'The environment variable "{env_var}" could not be found'
        super().__init__(self.message)

APIException

Bases: Exception

Exception raised when an error occurred while processing an API request

Source code in src/mmisp/worker/exceptions/misp_api_exceptions.py
 4
 5
 6
 7
 8
 9
10
11
class APIException(Exception):
    """
    Exception raised when an error occurred while processing an API request
    """

    def __init__(self: Self, message: str = "An Error occurred while processing the API request") -> None:
        self.message = message
        super().__init__(self.message)

InvalidAPIResponse

Bases: Exception

Exception raised when an API response is not valid

Source code in src/mmisp/worker/exceptions/misp_api_exceptions.py
14
15
16
17
18
19
20
21
class InvalidAPIResponse(Exception):
    """
    Exception raised when an API response is not valid
    """

    def __init__(self: Self, message: str = "The API response is not valid") -> None:
        self.message = message
        super().__init__(self.message)

ForbiddenByServerSettings

Bases: Exception

Exception raised when a requested action was denied by another servers settings

Source code in src/mmisp/worker/exceptions/server_exceptions.py
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
class ForbiddenByServerSettings(Exception):
    """
    Exception raised when a requested action was denied by another servers settings
    """

    def __init__(
        self: Self,
        server_id: str | None = None,
        message: str = "A requested action was denied by another servers settings",
    ) -> None:
        if server_id is None:
            self.message: str = message
        else:
            self.message = f"The requested action was denied by the server with id: {server_id} because of its settings"
        super().__init__(self.message)

InvalidServerVersion

Bases: Exception

Exception raised when a server has an invalid version

Source code in src/mmisp/worker/exceptions/server_exceptions.py
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
class InvalidServerVersion(Exception):
    """
    Exception raised when a server has an invalid version
    """

    def __init__(
        self: Self,
        server_id: str | None = None,
        message: str = "Another server that was requested has an invalid version",
    ) -> None:
        if server_id is None:
            self.message = message
        else:
            self.message = f"The server with id: {server_id} has an invalid version"
        super().__init__(self.message)

ServerNotReachable

Bases: Exception

Exception raised when a server is not reachable

Source code in src/mmisp/worker/exceptions/server_exceptions.py
21
22
23
24
25
26
27
28
29
30
31
class ServerNotReachable(Exception):
    """
    Exception raised when a server is not reachable
    """

    def __init__(self: Self, server_id: str | None = None, message: str = "A server is not reachable") -> None:
        if server_id is None:
            self.message = message
        else:
            self.message = f"The server with id: {server_id} is not reachable"
        super().__init__(self.message)