Skip to content

Commit

Permalink
chore(isolate): inherit exceptions from IsolateException (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
efiop authored May 10, 2024
1 parent 69f556d commit 255b460
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/isolate/backends/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
)

from isolate.backends.settings import DEFAULT_SETTINGS, IsolateSettings
from isolate.exceptions import IsolateException
from isolate.logs import Log, LogLevel, LogSource

__all__ = [
Expand All @@ -27,7 +28,7 @@
BasicCallable = Callable[[], CallResultType]


class EnvironmentCreationError(Exception):
class EnvironmentCreationError(IsolateException):
"""Raised when the environment cannot be created."""


Expand Down
4 changes: 3 additions & 1 deletion src/isolate/connections/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

from tblib import Traceback, TracebackParseError

from isolate.exceptions import IsolateException

if TYPE_CHECKING:
from typing import Protocol

Expand All @@ -21,7 +23,7 @@ def dumps(self, obj: Any) -> bytes: ...


@dataclass
class SerializationError(Exception):
class SerializationError(IsolateException):
"""An error that happened during the serialization process."""

message: str
Expand Down
3 changes: 2 additions & 1 deletion src/isolate/connections/grpc/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
from isolate.connections.grpc import agent, definitions
from isolate.connections.grpc.configuration import get_default_options
from isolate.connections.grpc.interface import from_grpc
from isolate.exceptions import IsolateException
from isolate.logs import LogLevel, LogSource


class AgentError(Exception):
class AgentError(IsolateException):
"""An internal problem caused by (most probably) the agent."""


Expand Down
3 changes: 2 additions & 1 deletion src/isolate/connections/grpc/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@
from isolate.connections.grpc import definitions
from isolate.connections.grpc.configuration import get_default_options
from isolate.connections.grpc.interface import from_grpc, to_grpc
from isolate.exceptions import IsolateException
from isolate.logs import Log, LogLevel, LogSource


@dataclass
class AbortException(Exception):
class AbortException(IsolateException):
message: str


Expand Down
2 changes: 2 additions & 0 deletions src/isolate/exceptions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class IsolateException(Exception):
pass

0 comments on commit 255b460

Please sign in to comment.