Skip to content

docs: Add user-facing error handling guide to docs/sdk_users/ #2245

Description

@bhuvan-somisetty

Summary

The SDK defines three exceptions in src/hiero_sdk_python/exceptions.pyPrecheckError, MaxAttemptsError, and ReceiptStatusError — but there is no user-facing documentation explaining when they are thrown, what their attributes mean, or how to handle them.

The existing docs/sdk_developers/training/receipt_status_error.md is written for SDK contributors, not end users. The docs/sdk_users/ directory currently contains only running_examples.md and transaction_bytes.md — nothing about errors.

Current Behavior

A developer using the SDK has no reference for error handling. They must read source code to understand what to catch:

try:
    receipt = await transaction.execute(client).get_receipt(client)
except ???:  # PrecheckError? ReceiptStatusError? Something else?
    pass

Expected Behavior

Add docs/sdk_users/error_handling.md covering:

  1. PrecheckError — thrown when a transaction fails pre-consensus validation. Attributes: status (ResponseCode), transaction_id.
  2. MaxAttemptsError — thrown when all retry attempts to a node are exhausted. Attributes: node_id, last_error.
  3. ReceiptStatusError — thrown when a receipt contains a non-SUCCESS status. Attributes: status, transaction_id, transaction_receipt.
  4. How to read ResponseCode values to understand the failure reason.
  5. A practical example showing all three in a single try/except block.
  6. Retry and backoff guidance (when to retry vs. when to give up).

Example Output

from hiero_sdk_python.exceptions import PrecheckError, MaxAttemptsError, ReceiptStatusError
from hiero_sdk_python.response_code import ResponseCode

try:
    receipt = transaction.execute(client).get_receipt(client)
except PrecheckError as e:
    print(f"Transaction rejected before consensus: {e.status.name}")
except ReceiptStatusError as e:
    print(f"Transaction reached consensus but failed: {e.status.name}")
except MaxAttemptsError as e:
    print(f"Could not reach node {e.node_id}: {e.last_error}")

Why This Is Distinct

Suggested Location

docs/sdk_users/error_handling.md with a link added to docs/sdk_users/running_examples.md and the main README.

Environment

  • SDK version: v0.2.6
  • Exceptions defined in: src/hiero_sdk_python/exceptions.py
  • Response codes defined in: src/hiero_sdk_python/response_code.py

Metadata

Metadata

Labels

skill: beginnerAchievable by a fairly new comer that has already completed a couple of good first issues

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions