File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed
Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -13,10 +13,11 @@ async fn main() {
1313
1414 match res {
1515 Err ( e) => {
16- eprintln ! ( "Error : {e}" ) ;
16+ log :: error !( "server exited with error : {e}" ) ;
1717 std:: process:: exit ( 1 ) ;
1818 }
1919 Ok ( _) => {
20+ log:: info!( "server exited successfully" ) ;
2021 std:: process:: exit ( 0 ) ;
2122 }
2223 }
@@ -35,7 +36,7 @@ async fn run() -> anyhow::Result<()> {
3536 . map_err ( |e| anyhow:: anyhow!( "unable to parse config file: {}" , e) ) ?;
3637
3738 inject_secrets ( & mut config) ?;
38- server:: run ( config) . await ;
39+ server:: run ( config) . await ? ;
3940 Ok ( ( ) )
4041}
4142
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ impl AppState {
3030 }
3131 }
3232}
33- pub async fn run ( config : ServerConfig ) {
33+ pub async fn run ( config : ServerConfig ) -> Result < ( ) , std :: io :: Error > {
3434 let db = & config. db ;
3535
3636 let db_connection_url = format ! (
@@ -56,7 +56,7 @@ pub async fn run(config: ServerConfig) {
5656 let addr = & app_state. config . http_bind_addr ;
5757 let server = poem:: Server :: new ( TcpListener :: bind ( addr) ) . run ( ep) ;
5858 log:: info!( "Listening on http://{}" , addr) ;
59- let _ = server. await ;
59+ server. await
6060}
6161
6262/**
You can’t perform that action at this time.
0 commit comments