Improved error handling
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing

This commit is contained in:
2023-01-18 22:37:57 +01:00
parent b6bf8a82a2
commit a0cefa8302
17 changed files with 189 additions and 184 deletions

View File

@@ -45,7 +45,7 @@ async fn main() {
}
async fn app() -> Result<(), Box<dyn std::error::Error>> {
async fn app() -> anyhow::Result<()> {
dotenv().ok();
let filter = EnvFilter::builder()
@@ -86,7 +86,8 @@ async fn app() -> Result<(), Box<dyn std::error::Error>> {
let identifier = identifier;
let device = device_config.create(&identifier, &config, client.clone()).await?;
devices.add_device(device).await?;
Ok::<(), Box<dyn std::error::Error>>(())
// We don't need a seperate error type in main
anyhow::Ok(())
})
).await.into_iter().collect::<Result<_, _>>()?;