Closed pauldelucia closed 1 week ago
The changes introduce a new error handling mechanism in the load
method of the Config
struct within the src/config.rs
file. A conditional check has been added to verify the successful loading of mainnet_config
and testnet_config
. If both configurations are None
, the method returns a ConfigError::NoValidConfigs
. Additionally, the AppState::new
and AppContext::new
methods in src/app.rs
and src/context.rs
, respectively, have been updated to enhance error handling during initialization. The NetworkChooserScreen
struct in src/ui/network_chooser_screen.rs
has also been modified to improve user feedback and error handling related to network configurations.
File | Change Summary |
---|---|
src/config.rs | Introduced ConfigError enum with variants for loading errors. Updated load method to return Result<Self, ConfigError> . Added error handling for configuration loading failures. |
src/app.rs | Modified AppState::new to use a match statement for initializing mainnet_app_context , replacing expect with error handling. |
src/context.rs | Updated AppContext::new to include error handling for configuration loading using a match statement. |
src/ui/network_chooser_screen.rs | Updated NetworkChooserScreen::new to use testnet_app_context.cloned() . Enhanced render_network_row with a check for None configurations. Improved error handling in start_dash_qt . |
sequenceDiagram
participant App
participant Config
App->>Config: Call load()
Config-->>App: Load mainnet_config
Config-->>App: Load testnet_config
alt Configurations are valid
App->>Config: Proceed with application
else Configurations are invalid
Config-->>App: Return ConfigError::NoValidConfigs
end
In the code where configs dwell,
A new check rings a warning bell.
If the load goes awry,
An error will cry,
"Invalid configs, all is not well!" 🐰✨
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Summary by CodeRabbit