File size: 922 Bytes
9792ea7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# -*- coding: utf-8 -*-
"""The base exception class in agentscope."""


class AgentOrientedException(Exception):
    """The base class for all agent-oriented exceptions. These exceptions are
    expect to the captured and exposed to the agent during runtime, so that
    agents can handle the error appropriately during the runtime.
    """

    def __init__(self, message: str):
        """Initialize the exception with a message."""
        super().__init__(message)
        self.message = message

    def __str__(self) -> str:
        """Return the string representation of the exception."""
        return f"{self.__class__.__name__}: {self.message}"


class DeveloperOrientedException(Exception):
    """The exception should be raised to the developers."""

    def __init__(self, message: str):
        """Initialize the exception with a message."""
        super().__init__(message)
        self.message = message