diff --git a/controller/src/main.rs b/controller/src/main.rs index 78d71cb..ed4a430 100644 --- a/controller/src/main.rs +++ b/controller/src/main.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, Result}; +use anyhow::Result; use clap::Parser; use dropshot::endpoint; use dropshot::ApiDescription; @@ -24,6 +24,7 @@ struct Cli {} /// Represents a project in our API. #[derive(Serialize, JsonSchema)] struct VersionInfo { + /// Name of the project. name: String, } @@ -40,7 +41,7 @@ async fn api_version(rqctx: RequestContext<Arc<()>>) -> Result<HttpResponseOk<Ve } #[tokio::main] -async fn main() -> Result<()> { +async fn main() -> Result<(), String> { let _args = Cli::parse(); let fmt_layer = tracing_subscriber::fmt::layer(); @@ -63,12 +64,11 @@ async fn main() -> Result<()> { tracing::info!("Patagia Controller"); let mut api = ApiDescription::new(); - api.register(api_version).unwrap(); + api.register(api_version).map_err(|e| e.to_string())?; - let server =ServerBuilder::new(api, Arc::new(()), dropshot_logger) + let server = ServerBuilder::new(api, Arc::new(()), dropshot_logger) .config(config_dropshot) .start() - .map_err(|e| anyhow!("Error starting server: {:?}", e))?; - - server.await.map_err(|e| anyhow!("Error running server: {}", e)) + .map_err(|e| e.to_string())?; + server.await }