Skip to content

Conversation

@Mohitlikestocode
Copy link

Summary

Fixes an edge case in the retry decorators where, when all retry attempts fail, the decorator raised a generic
MemoriError("Retry attempts exhausted") instead of re-raising the original (last) exception. This masked the
real error and made debugging difficult.

Changes

  • memori/utils/helpers.py
    • Both retry_on_exception and async_retry_on_exception now re-raise the last exception (preserving traceback)
      if present; MemoriError is only raised as a fallback if no exception was captured.
  • tests/test_retry_helpers.py (new)
    • Added tests for both sync and async retry decorators to verify the original exception is re-raised and retry counts are correct.
  • CHANGELOG.md
    • Added an "Unreleased" note describing the bugfix.

Motivation and Context

Fixes #110 (Hacktoberfest) – consumers could not see the real exception causing retry failures because it was replaced
by a generic MemoriError. With this change, the original exception (and its traceback) will be surfaced.

How to Test

  1. Run the test suite (recommended):
python -m venv .venv
.\\.venv\\Scripts\\Activate.ps1
pip install -r requirements-dev.txt
pip install pytest
pytest -q
@@ -0,0 +1,38 @@
import pytest
import asyncio

Check notice

Code scanning / CodeQL

Unused import Note test

Import of 'asyncio' is not used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant