Skip to content

Commit 2392806

Browse files
paultranvanclaude
andcommitted
refactor: add exception subclasses used by core services
FileStorageError, RayActorError, ToolExecutionError, and UnexpectedError moved here from phase-2 since this is where they are first raised. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 107ef34 commit 2392806

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
from .base import *
2+
from .common import *

openrag/utils/exceptions/common.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
from .base import OpenRAGError
2+
3+
4+
class FileStorageError(OpenRAGError):
5+
"""Raised when file I/O operations fail (save, read, delete)."""
6+
7+
def __init__(self, message: str, **kwargs):
8+
super().__init__(message=message, code="FILE_STORAGE_ERROR", status_code=500, **kwargs)
9+
10+
11+
class RayActorError(OpenRAGError):
12+
"""Raised when a Ray actor operation fails."""
13+
14+
def __init__(self, message: str, **kwargs):
15+
super().__init__(message=message, code="RAY_ACTOR_ERROR", status_code=500, **kwargs)
16+
17+
18+
class ToolExecutionError(OpenRAGError):
19+
"""Raised when tool execution fails."""
20+
21+
def __init__(self, message: str, **kwargs):
22+
super().__init__(message=message, code="TOOL_EXECUTION_ERROR", status_code=500, **kwargs)
23+
24+
25+
class UnexpectedError(OpenRAGError):
26+
"""Raised for unexpected errors that don't match any specific category."""
27+
28+
def __init__(self, message: str, **kwargs):
29+
super().__init__(message=message, code="UNEXPECTED_ERROR", status_code=500, **kwargs)

0 commit comments

Comments
 (0)