MCPcopy Create free account
hub / github.com/MiroMindAI/MiroThinker / ErrorBox

Class ErrorBox

apps/miroflow-agent/src/utils/wrapper_utils.py:9–33  ·  view source on GitHub ↗

A wrapper class for error messages. Use this to wrap error messages that should be distinguishable from normal responses. Example: >>> error = ErrorBox("Connection failed") >>> if ErrorBox.is_error_box(error): ... print(f"Error: {error}")

Source from the content-addressed store, hash-verified

7
8
9class ErrorBox:
10 """
11 A wrapper class for error messages.
12
13 Use this to wrap error messages that should be distinguishable from normal responses.
14
15 Example:
16 >>> error = ErrorBox("Connection failed")
17 >>> if ErrorBox.is_error_box(error):
18 ... print(f"Error: {error}")
19 """
20
21 def __init__(self, error_msg: str) -> None:
22 self.error_msg = error_msg
23
24 def __str__(self) -> str:
25 return self.error_msg
26
27 def __repr__(self) -> str:
28 return f"ErrorBox({self.error_msg!r})"
29
30 @staticmethod
31 def is_error_box(something: Any) -> bool:
32 """Check if the given object is an ErrorBox instance."""
33 return isinstance(something, ErrorBox)
34
35
36class ResponseBox:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected