Skip to content

Commit

Permalink
fix: Fix serialization error caused by ignored field in ErrorInfo object
Browse files Browse the repository at this point in the history
- Change `ErrorInfo` class attribute `_repr` to `repr` for consistent serialization
- Update `__repr__` method to return `self.repr` instead of `self._repr`
  • Loading branch information
Pwuts committed Oct 30, 2023
1 parent fc1d73b commit 653fc58
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions autogpts/autogpt/autogpt/models/action_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,22 @@ class ErrorInfo(BaseModel):
args: tuple
message: str
exception_type: str
_repr: str
repr: str

@staticmethod
def from_exception(exception: Exception) -> ErrorInfo:
return ErrorInfo(
args=exception.args,
message=getattr(exception, "message", exception.args[0]),
exception_type=exception.__class__.__name__,
_repr=repr(exception),
repr=repr(exception),
)

def __str__(self):
return repr(self)

def __repr__(self):
return self._repr
return self.repr


class ActionErrorResult(BaseModel):
Expand Down

0 comments on commit 653fc58

Please sign in to comment.