Skip to content

Commit

Permalink
fix: use error propagation
Browse files Browse the repository at this point in the history
  • Loading branch information
RealHinome authored Dec 28, 2023
1 parent b73ed2f commit cf11d8b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
pub mod corpus;
pub mod helpers;

use anyhow::Result;
use corpus::CorpusManager;
use remini::remini_server::{Remini as Rem, ReminiServer};
use remini::{Reply as ReminiReply, Request as ReminiRequest};
Expand Down Expand Up @@ -40,7 +41,7 @@ impl Rem for Remini {
error: false,
})),
Err(error) => {
log::error!("Corpus model got an error; {}", error);
log::error!("Corpus model got an error: {}", error);

Ok(Response::new(ReminiReply {
model: content.model,
Expand All @@ -59,7 +60,7 @@ impl Rem for Remini {
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
async fn main() -> Result<()> {
// Set logger with Fern.
fern::Dispatch::new()
.format(|out, message, record| {
Expand All @@ -81,11 +82,10 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
log::LevelFilter::Info
})
.chain(std::io::stdout())
.apply()
.unwrap();
.apply()?;

let addr = format!(
"[::1]:{}",
"0.0.0.0:{}",
std::env::var("port").unwrap_or("50051".to_string())
)
.parse()?;
Expand Down

0 comments on commit cf11d8b

Please sign in to comment.