Skip to content
Snippets Groups Projects
  • Alexandru Gheorghe's avatar
    make polkadot-parachain startup errors pretty (#5214) · 0cc3e170
    Alexandru Gheorghe authored
    
    The errors on polkadot-parachain are not printed with their full display
    context(what is marked with `#[error(`) because main returns plain
    Result and the error will be shown in its Debug format, that's not
    consistent with how the polkadot binary behave and is not user friendly
    since it does not tell them why they got the error.
    
    Fix it by using `color_eyre` as polkadot already does it. 
    
    Fixes: https://github.com/paritytech/polkadot-sdk/issues/5211
    
    ## Output before
    ```
    Error: NetworkKeyNotFound("/acala/data/Collator2/chains/mandala-tc9/network/secret_ed25519")
    ```
    
    ## Output after
    ```
    Error: 
       0: Starting an authorithy without network key in /home/alexggh/.local/share/polkadot-parachain/chains/asset-hub-kusama/network/secret_ed25519.
          
           This is not a safe operation because other authorities in the network may depend on your node having a stable identity.
          
           Otherwise these other authorities may not being able to reach you.
          
           If it is the first time running your node you could use one of the following methods:
          
           1. [Preferred] Separately generate the key with: <NODE_BINARY> key generate-node-key --base-path <YOUR_BASE_PATH>
          
           2. [Preferred] Separately generate the key with: <NODE_BINARY> key generate-node-key --file <YOUR_PATH_TO_NODE_KEY>
          
           3. [Preferred] Separately generate the key with: <NODE_BINARY> key generate-node-key --default-base-path
          
           4. [Unsafe] Pass --unsafe-force-node-key-generation and make sure you remove it for subsequent node restarts
    
    ```
    
    ---------
    
    Signed-off-by: default avatarAlexandru Gheorghe <alexandru.gheorghe@parity.io>
    Unverified
    0cc3e170
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
Cargo.lock 505.68 KiB