Skip to content

Conversation

wangfan00001
Copy link

✨ What kind of change does this PR introduce? (Bug fix, feature, docs update...)

Bug fix

⤵️ What is the current behavior?

When database operations in the retrieveCacheData method encounter exceptions, error callbacks are not properly executed. Specifically:

  • When _getCacheDataFromDatabase or related async operations throw exceptions, the Completer is not handled correctly
  • Exceptions are not caught and propagated, preventing callers from receiving error callbacks
  • Entries in _futureCache may not be properly cleaned up, causing memory leaks

🆕 What is the new behavior (if this is a feature change)?

After the fix:

  • Added catchError handler to properly catch and propagate exceptions to the completer
  • Ensures proper cleanup of _futureCache in both success and error paths
  • Callers can now properly receive error callbacks in exception scenarios

💥 Does this PR introduce a breaking change?

No

🐛 Recommendations for testing

  • Simulate database connection exceptions to verify error callbacks are properly executed
  • Test scenarios where _fileExists method throws exceptions
  • Verify handling when _cacheInfoRepository access fails
  • Confirm that _futureCache is properly cleaned up in exception cases

📝 Links to relevant issues/docs

N/A

🤔 Checklist before submitting

  • All projects build
  • Follows style guide lines (code style guide)
  • Relevant documentation was updated
  • Rebased onto current develop

- Add catchError handler to properly propagate errors to completer
- Ensure _futureCache cleanup on both success and error paths
@wangfan00001 wangfan00001 force-pushed the fix/retrieve-cache-data-exception-handling branch from 6354c60 to c303009 Compare September 26, 2025 03:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant