refactor: detailed error messages for users #3427
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This refactoring lets us improve the user experience if a node failed.
Motivation and Context
Related to #3423. These changes help us to fix the following issues.
Duplications like this:
applications/tari_app_utilities/src/identity_management.rs#L58
Avoid logging in converting methods and let us derive
From
automatically:applications/tari_app_utilities/src/utilities.rs#L130
Handle potential panics:
applications/tari_app_utilities/src/identity_management.rs#L201
Not everything can be converted to JSON, and if we change the format of an object (and will have numbers as keys of maps, etc.), we can have panic there.
Later we can also implement the standard
Termination
trait (not stabilized yet) for this:applications/tari_app_utilities/src/utilities.rs#L86
And use
ExitCodes
as returnedError
of themain
function.Improve specific errors checking:
applications/tari_base_node/src/main.rs#L220
It's the potential issue if we will change the error's message and forget to sync the text above.
How Has This Been Tested?
Not tested yet 🙃 (to be updated...)