-
Notifications
You must be signed in to change notification settings - Fork 92
chore: add documentation for max attempts error #898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
chore: add documentation for max attempts error #898
Conversation
…hiero-ledger#830) Signed-off-by: MonaaEid <monaa_eid@hotmail.com> Signed-off-by: MontyPokemon <59332150+MonaaEid@users.noreply.github.com> Signed-off-by: kubanjaelijaheldred <kubanjaelijah2037@gmail.com>
Signed-off-by: KUBANJA ELIJAH ELDRED <kubanjaelijah2037@gmail.com>
|
Hi @KubanjaElijahEldred Alternatively you'll need to rebase from main, soft revert, then resign only your changes (more advanced) Please get in touch if you need help, read MAINTAINERS.md
|
|
ok
…On Wed, 26 Nov 2025 at 18:09, exploreriii ***@***.***> wrote:
*exploreriii* left a comment (hiero-ledger/hiero-sdk-python#898)
<#898 (comment)>
Hi @KubanjaElijahEldred <https://github.com/KubanjaElijahEldred>
Please I recommend you start again, you have added a change to someone
elses commit - you can see here you are changing Monaad's commit
Alternatively you'll need to rebase from main, soft revert, then resign
only your changes (more advanced)
Please get in touch if you need help, read MAINTAINERS.md
Screenshot.2025-11-26.at.15.07.33.png (view on web)
<https://github.com/user-attachments/assets/d03c9a3a-19c5-4afa-82b7-397c80e981d8>
—
Reply to this email directly, view it on GitHub
<#898 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BMFILB3LMPTQSE24AFH5D3D36W7C3AVCNFSM6AAAAACNIPXHJKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTKOBRG42TIMRVHE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
Hello, please contact me if you'd like help, see MAINTAINERS.md |
|
Hi, this is WorkflowBot.
|
| - Added `examples/token_create_transaction_wipe_key.py` to demonstrate token wiping and the role of the wipe key. | ||
| - Added `examples/account_allowance_approve_transaction_hbar.py` and `examples/account_allowance_delete_transaction_hbar.py`, deleted `examples/account_allowance_hbar.py`. [#775] | ||
| - Added `docs\sdk_developers\training\receipts.md` as a training guide for users to understand hedera receipts. | ||
| - Add comprehensive documentation for `MaxAttemptsError` in `docs/sdk_developers/training/max_attempts_error.md` (2025-11-26) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello please move these changelog entries to the UNRELEASED section 👍
i.e. under added roughly in line 10
- Add comprehensive documentation for
MaxAttemptsErrorindocs/sdk_developers/training/max_attempts_error.md(2025-11-26) - Add practical example
examples/errors/max_attempts_error.pydemonstrating network error handling and recovery strategies (2025-11-26) - Document error handling patterns for network failures and node retry attempts (Create docs/sdk_developers/training/max_attempts_error.md #877)
|
|
||
| Many developers assume that if `execute()` doesn't throw, the transaction succeeded. These exceptions explicitly show different stages of failure. | ||
|
|
||
| ## Example Usage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to demonstrate the other two error types 👍
We can just explain you can catch a MaxAttemptsError like so
except MaxAttemptsError as e:
print(f"Max attempts reached: {e}")
Then for a full demonstration, add a link to the example.
| when the SDK exhausts retry attempts to communicate with network nodes. | ||
| """ | ||
|
|
||
| import time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi - lots of good stuff here, however, the script currently does not work
I had a go from what you had above and added some fixes:
import os
import dotenv
from hiero_sdk_python import TransferTransaction
from hiero_sdk_python.exceptions import MaxAttemptsError
from hiero_sdk_python.client.network import Network
from hiero_sdk_python.client.client import Client
from hiero_sdk_python.account.account_id import AccountId
from hiero_sdk_python.crypto.private_key import PrivateKey
from hiero_sdk_python.response_code import ResponseCode
from hiero_sdk_python.account.account_create_transaction import AccountCreateTransaction
from hiero_sdk_python.node import _Node
dotenv.load_dotenv()
def custom_network_from_dict(node_dict: dict[str, str]) -> Network:
nodes = []
for account, address in node_dict.items():
nodes.append(_Node(AccountId.from_string(account), address, None))
return Network(network="custom", nodes=nodes)
def setup_client() -> Client:
"""Initialize and set up the client with operator account using env vars."""
network = custom_network_from_dict({"0.0.3": "192.0.2.0:50211"})
client = Client(network)
operator_id = AccountId.from_string(os.getenv("OPERATOR_ID", ""))
operator_key = PrivateKey.from_string(os.getenv("OPERATOR_KEY", ""))
client.set_operator(operator_id, operator_key)
print(f"Client set up with operator id {client.operator_account_id}")
return client
client = setup_client()
new_private_key = PrivateKey.generate()
new_public_key = new_private_key.public_key()
receipt = (AccountCreateTransaction()
.set_key(new_public_key)
.set_initial_balance(10_000_000)
.freeze_with(client)
.sign(client.operator_private_key)
.execute(client)
)
new_account_id = receipt.account_id
hbar_transaction = (TransferTransaction()
.add_hbar_transfer(client.operator_account_id, -1000)
.add_hbar_transfer(new_account_id, 1000)
.freeze_with(client)
.sign(client.operator_private_key)
)
try:
# Execute the transaction
receipt_hbar = hbar_transaction.execute(client)
print("Transaction executed, checking receipt status...")
print(f"The response code is {ResponseCode(receipt_hbar.status).name}")
except MaxAttemptsError as e:
print(f"Max attempts reached: {e}")We can use the environment variables and don't need to create too much new variables
Please use and edit this to show what you'd like - and make sure it runs! Contact us if needed
docs/sdk_developers/discord.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this may wokr without creating an account

… (#830)
Description:
Related issue(s):
Fixes #
Notes for reviewer:
Checklist