Skip to content

(fix) Improve error handling and output#781

Open
HarK-github wants to merge 5 commits into
hyperledger-labs:mainfrom
HarK-github:fix_error_messages
Open

(fix) Improve error handling and output#781
HarK-github wants to merge 5 commits into
hyperledger-labs:mainfrom
HarK-github:fix_error_messages

Conversation

@HarK-github

@HarK-github HarK-github commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

(Fixes #758)

This PR addresses hardcoded message discrepancies, improves error messaging for config parsing failures, cleans up obsolete comments/snapshots, and refactors argument passing to prevent parameter truncation.

Changes

Validation & Config

  • Standardized Raft consensus error messages to use a single source of truth (minFabricVersionRaft) instead of raw function references.

Fablo Config Parser

  • Enhanced the config parser to surface detailed underlying errors from both JSON and YAML parser attempts.

Templates & Scripts

  • Refactored argument relaying in Docker templates using array slicing syntax to safely forward all dynamic arguments downstream.
  • Fixed a validation typo where a chaincode invoke failure referenced a "chaincode list" error.

Cleanup & Tests

  • Removed redundant comments and an obsolete E2E snapshot entry.
  • Added a new unit test for detailed parser error throwing and verified dynamic argument translation.

1. CLI Parameter Forwarding

Run a chaincode invoke command with dynamic arguments:

./fablo.sh chaincode invoke peer0.org1.example.com my-channel1 chaincode1 '{"Args":["KVContract:put", "name", "value"]}'
  • Before: The command was padded with trailing empty strings, failing parameter count validation.
  • After: Parameters are forwarded cleanly without truncation or padding, and the command executes successfully.

2. Config Parsing Errors

Pass a malformed configuration file to the validator:

node ./dist/src/index.js validate samples/invalid-fablo-config.json
  • Before: Failed with a generic Cannot parse config file. error.
  • After: Prints the specific underlying JSON or YAML syntax exceptions.

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.

fix: incorrect error messages and exit codes across CLI and generated scripts

1 participant