Skip to content

Conversation

SuchitraSwain
Copy link

@SuchitraSwain SuchitraSwain commented Sep 13, 2025

What was wrong?

Issue #194

How was it fixed?

Replaced return value pattern with try/catch pattern:

  • Removed the :return: true if successful from docstring
  • Added :raises HostException: documentation
  • Implemented comprehensive exception handling

Summary of approach.

To-Do

  • Clean up commit history
  • Add or update documentation related to these changes
  • Add entry to the release notes

Cute Animal Picture

image

Suchitra Swain added 2 commits September 13, 2025 14:20
- Update multiaddr dependency from 3ea7f866fda9268ee92506edf9d8e975274bf941 to db8124e2321f316d3b7d2733c7df11d6ad9c03e6
- This fixes the build failure caused by missing py-cid branch 'acul71/new-setup'
- Resolves Read the Docs build failure in PR libp2p#923
Copy link
Contributor

@sumanjeet0012 sumanjeet0012 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SuchitraSwain You can take a look at other methods which is still using the True / False return value and change it to responce / exception.

except HostException:
raise
except Exception as e:
raise HostException(f"Failed to set stream handler: {e}") from e
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SuchitraSwain Thank you for adding the try-catch block and input validation to this function. However, I believe this PR may not be addressing the core issue described in #194.
Issue #194 is specifically about "changing return True/False pattern to try/catch pattern," but the True/False pattern has already been removed from py-libp2p in previous commits.
For reference, the earlier implementation at this commit did use the True/False return pattern, but the current codebase has already migrated away from this pattern.

@sumanjeet0012
Copy link
Contributor

@SuchitraSwain Have you tried running all the tests locally? Are they all passing?
Since these changes may impact other modules, please ensure that all tests pass locally first. After that, we can proceed with running the CI/CD pipeline.

@SuchitraSwain
Copy link
Author

@SuchitraSwain Have you tried running all the tests locally? Are they all passing? Since these changes may impact other modules, please ensure that all tests pass locally first. After that, we can proceed with running the CI/CD pipeline.

YES I have tested it locally, everything passes

@sumanjeet0012
Copy link
Contributor

@SuchitraSwain resolve the merge conflicts.

@sumanjeet0012
Copy link
Contributor

@seetadev kindly run the CI/CD pipeline.

@seetadev
Copy link
Contributor

@sumanjeet0012 : Ran the CI/Cd pipeline. Waiting for test results.

@seetadev
Copy link
Contributor

@SuchitraSwain : 2 test cases are failing. Please collaborate with @sumanjeet0012 and @acul71 to get them fixed and arrive at a good conclusion on this PR.

@SuchitraSwain
Copy link
Author

@seetadev could you please re-run the ci/cd again

@SuchitraSwain
Copy link
Author

SuchitraSwain commented Sep 15, 2025

@seetadev The PR is ready

@seetadev
Copy link
Contributor

@SuchitraSwain : Thank you so much Suchitra for considering our feedback points. Appreciate it.

Will do a final review today. Please add a test suite and a newsfragment file too.

CCing @sumanjeet0012, who will help you complete these aspects in the PR.

Copy link
Contributor

@sumanjeet0012 sumanjeet0012 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SuchitraSwain The PR looks good to me and is ready to go from my side. I have just left a minor piece of feedback for your consideration.
Once it is addressed, we will run the CI/CD pipeline and proceed with merging this PR.

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.

3 participants