mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-09-04 02:25:08 +00:00
refactor(agent): Refactor resource of agents (#1518)
This commit is contained in:
35
dbgpt/agent/resource/tool/exceptions.py
Normal file
35
dbgpt/agent/resource/tool/exceptions.py
Normal file
@@ -0,0 +1,35 @@
|
||||
"""Exceptions for the tool."""
|
||||
|
||||
|
||||
class ToolException(Exception):
|
||||
"""Common tool error exception."""
|
||||
|
||||
def __init__(self, message: str, error_type: str = "Common Error"):
|
||||
"""Create a new ToolException instance."""
|
||||
super().__init__(message)
|
||||
self.message = message
|
||||
self.error_type = error_type
|
||||
|
||||
|
||||
class CreateToolException(ToolException):
|
||||
"""Create tool error exception."""
|
||||
|
||||
def __init__(self, message: str, error_type="Create Command Error"):
|
||||
"""Create a new CreateToolException instance."""
|
||||
super().__init__(message, error_type)
|
||||
|
||||
|
||||
class ToolNotFoundException(ToolException):
|
||||
"""Tool not found exception."""
|
||||
|
||||
def __init__(self, message: str, error_type="Not Command Error"):
|
||||
"""Create a new ToolNotFoundException instance."""
|
||||
super().__init__(message, error_type)
|
||||
|
||||
|
||||
class ToolExecutionException(ToolException):
|
||||
"""Tool execution error exception."""
|
||||
|
||||
def __init__(self, message: str, error_type="Execution Command Error"):
|
||||
"""Create a new ToolExecutionException instance."""
|
||||
super().__init__(message, error_type)
|
Reference in New Issue
Block a user