Node icon indicating copy to clipboard operation
Node copied to clipboard

Make meaningful Errors from Daemon to UI

Open czarte opened this issue 4 months ago • 1 comments

This card has much in common with #697 . The two should perhaps be played at the same time.

Problem

There is sometimes not easy to recognize from Daemon error messages, what is going on with Node when not starting:

Error in UI: Could not launch Node: Node started in process 2551, but died immediately. (Code 8000_0000_0000_0001) Error in Log:

Configuration error
<unknown> - Unfamiliar message: The following required argument was not provided: --blockchain-service-url USAGE: --blockchain-service-url <blockchain-service-url>

Error in UI: Could not launch Node: Node started in process 3059, but died immediately. (Code 8000_0000_0000_0001) Error in Log:

2025-10-05 20:03:19.050 Thd1: ERROR: PanicHandler: src/privilege_drop.rs:83:17 - Attempt to drop group privileges failed: still root

Error in UI: Could not launch Node: Node started in process 2626, but died immediately. (Code 8000_0000_0000_0001) Error in Log:

2025-10-07 10:15:12.451 Thd1: ERROR: PanicHandler: src/database/db_migrations/migrator_utils.rs:91:13 - Database claims to be more advanced (11) than the version 10 which is the latest version this Node knows about.

Description

In case Node does not start, Daemon returns to the UI the very same Error Code - Code 8000_0000_0000_0001 which does not bear any useful unformation. Real reason is hidden in Log, so we want to grab that Log error and send it from Daemon with particular Error Code

Solution

Create Error Code, unique for each reason of Panic, or Configuration Error, that can be sense in Log by Damon.

Make Daemon capture the panic, and in case of panic, look into the log and catch the Error message from Nodes Panic, then send this message to UI

czarte avatar Oct 05 '25 20:10 czarte

There are two tasks here, possibly worthy of separate cards.

One task is to make non-fatal Node errors machine-readable to the front end, so that the front end can decide to take specific actions for specific errors, without forcing the front-end development team to order new development from the back-end development team. Suggestion: Remove the numeric error code and replace it with a string enum value and an array of string parameters in a fixed order. For example:

"errorInfo": {
  "errorName": "missingRequiredSetup",
  "parameters": [
    "blockchain-service-url"
  ],
  "displayMessage": "The following required argument was not provided: --blockchain-service-url USAGE: --blockchain-service-url <blockchain-service-url>"
}

The other task is to modify the Daemon so that instead of just adding the Node's log to its own log when the Node panics, it can examine the text of the Node's log and find the actual panic message from the Node, and package it up in one of the errorInfo structures outlined above and send it to the front end, so that the front end can display it in a friendly way.

dnwiebe avatar Nov 09 '25 21:11 dnwiebe