Skip to content

[Good First Issue]: Align file name and improve error handling in examples/tokens/token_freeze_transaction.py #1412

@MonaaEid

Description

@MonaaEid

🆕🐥 First Timers Only

This issue is reserved for people who have never contributed or have made minimal contributions to Hiero Python SDK.
We know that creating a pull request (PR) is a major barrier for new contributors.
The goal of this issue and all other issues in find a good first issue is to help you make your first contribution to the Hiero Python SDK.

👾 Description of the issue

we have in examples/tokens/token_freeze_transaction.py file two improvements we’d like contributors to make,
1- File name alignment:

  • the run instructions at the top currently say:
# uv run examples/tokens/token_freeze.py
# python examples/tokens/token_freeze.py
  • These should be removed since the actual file name is (token_freeze_transaction.py), to avoid confusing beginners.

2- Error handling improvements:

  • Right now, errors are caught narrowly, for example:
except RuntimeError as e:
     print(f"✅ Verified: Transfer failed as expected due to freeze. Error: {e}")
      sys.exit(1) 
  • This should be expanded to handle a wider range of exceptions (e.g., Exception) and provide more helpful guidance.

💡 Proposed Solution

1 -Remove the run instructions at the top of the file since there is another run instructions docstring.
2- Replace all except RuntimeError as e: blocks with broader error handling.

👩‍💻 Implementation Steps

Steps to follow:
1 - Open examples/tokens/token_freeze_transaction.py.
2- Remove the run instructions at the top of the file

# uv run examples/tokens/token_freeze.py
# python examples/tokens/token_freeze.py

3- Find all except RuntimeError as e: blocks.
4- Replace them with broader error handling, for example:

except Exception as e:
    print(f"❌ Error freezing token: {e}")
    sys.exit(1)

5- Test the script by running it with uv run or python to ensure the new instructions and error handling work correctly.

✅ Acceptance Criteria

To be able to merge a pull request for this issue, we need:

  • Assignment: get assigned by commenting /assign see guide
  • Changelog Entry: Correct changelog entry see guide
  • Signed commits: commits must be DCO and GPG key signed see guide
  • All Tests Pass: our workflow checks like unit and integration tests must pass
  • Issue is Solved: The implementation fully addresses the issue requirements as described above
  • No Further Changes are Made: Code review feedback has been addressed and no further changes are requested

📋 Step-by-Step Contribution Guide

If you have never contributed to an open source project at GitHub, the following step-by-step guide will introduce you to the workflow.

  • Assignment: get assigned by commenting /assign see guide
  • Fork, Branch and Work on the issue: Create a copy of the repository, create a branch for the issue and solve the problem. For instructions, please read our Contributing guide file. Further help can be found at Set-up Training and Workflow Training.
  • DCO and GPG key sign each commit : each commit must be -s and -S signed. An explanation on how to do this is at Signing Guide
  • Add a Changelog Entry : your pull request will require a changelog. Read Changelog Entry Guide to learn how.
  • Push and Create a Pull Request : Once your issue is resolved, and your commits are signed, and you have a changelog entry, push your changes and create a pull request. Detailed instructions can be found at Submit PR Training, part of Workflow Training.
  • You did it 🎉: A maintainer or committer will review your pull request and provide feedback. If approved, we will merge the fix in the main branch. Thanks for being part of the Hiero community as an open-source contributor ❤️

IMPORTANT You will ONLY be assigned to the issue if you comment: /assign
IMPORTANT Your pull request CANNOT BE MERGED until you add a changelog entry AND sign your commits each with git commit -S -s -m "chore: your commit message" with a GPG key setup.

🤔 Additional Information

For more help, we have extensive documentation attributes:

Additionally, we invite you to join our community on our Discord server.

We also invite you to attend each Wednesday, 2pm UTC our Python SDK Office Hour and Community Calls. The Python SDK Office hour is for hands-on-help and the Community Call for general community discussion.

You can also ask for help in a comment below!

Metadata

Metadata

Assignees

Labels

Good First IssueIssues which are ideal for a first time or new project contributor.pythonUses Python programming language

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions