Skip to content

fix: normalize error message prefix to ERROR: for consistency [fj4WqyCCw3C5ShR1RfB7MoBPTpkRrBFYP1uT35g3MvT] - #8092

Open
waterWang wants to merge 1 commit into
Scottcjn:mainfrom
waterWang:fix/consistent-error-handling
Open

fix: normalize error message prefix to ERROR: for consistency [fj4WqyCCw3C5ShR1RfB7MoBPTpkRrBFYP1uT35g3MvT]#8092
waterWang wants to merge 1 commit into
Scottcjn:mainfrom
waterWang:fix/consistent-error-handling

Conversation

@waterWang

Copy link
Copy Markdown
Contributor

Summary

Fixes inconsistent error message formatting in tools/rustchain_wallet_cli.py per RustChain bounty #16253 / issue #7889.

Changes

Normalized error message prefix — all error messages now use ERROR: (uppercase) consistently instead of a mix of Error: and ERROR::

File Line Before After
tools/rustchain_wallet_cli.py 213 Error: missing dependency ERROR: missing dependency
tools/rustchain_wallet_cli.py 220 Error: password mismatch ERROR: password mismatch
tools/rustchain_wallet_cli.py 249 Error: missing dependency ERROR: missing dependency
tools/rustchain_wallet_cli.py 257 Error: password mismatch ERROR: password mismatch
tools/rustchain_wallet_cli.py 295 Error: Server returned HTTP ERROR: Server returned HTTP
tools/rustchain_wallet_cli.py 307 Error: Server returned JSON but not an object ERROR: Server returned JSON but not an object
tools/rustchain_wallet_cli.py 481 Error: {e} ERROR: {e}

Exit code scheme (unchanged, already documented in --help)

Exit codes:
  0  success
  1  usage / input error
  2  network / connectivity error
  3  bad / unexpected response from server
  4  wallet not found
  5  authentication / decryption failure
  6  unexpected internal error

Verification

The cmd_balance function already handles all expected failure paths correctly:

  • Network error → EXIT_NETWORK_ERROR (2) with ERROR: on stderr ✅
  • HTTP 404 → EXIT_WALLET_NOT_FOUND (4) with ERROR: on stderr ✅
  • HTTP non-200 → EXIT_BAD_RESPONSE (3) with ERROR: on stderr ✅
  • Non-JSON response → EXIT_BAD_RESPONSE (3) with ERROR: on stderr ✅
  • Missing field in response → EXIT_BAD_RESPONSE (3) with ERROR: on stderr ✅
  • Success → EXIT_SUCCESS (0) with JSON on stdout ✅
  • Unknown exception → EXIT_UNKNOWN_ERROR (6) with ERROR: on stderr ✅

Closes: #7889

@waterWang
waterWang requested a review from Scottcjn as a code owner July 28, 2026 23:41
@github-actions

Copy link
Copy Markdown
Contributor

Welcome to RustChain! Thanks for your first pull request.

Before we review, please make sure:

  • Non-doc PRs have a BCOS-L1 or BCOS-L2 label
  • Doc-only PRs are exempt from BCOS tier labels when they only touch docs/**, *.md, or common image/PDF files
  • New code files include an SPDX license header
  • You've tested your changes against the live node

Bounty tiers: Micro (1-10 RTC) | Standard (20-50) | Major (75-100) | Critical (100-150)

A maintainer will review your PR soon. Thanks for contributing!

@github-actions github-actions Bot added the BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) label Jul 28, 2026
@github-actions github-actions Bot added the size/S PR: 11-50 lines label Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BCOS-L1 Beacon Certified Open Source tier BCOS-L1 (required for non-doc PRs) size/S PR: 11-50 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Inconsistent Error Handling in Wallet Balance Check Script

1 participant