Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Indy2222 committed Oct 7, 2023
1 parent 443524c commit af1c4bd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
11 changes: 4 additions & 7 deletions crates/connector/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use anyhow::Context;
use async_std::task;
use de_net::Socket;
use tracing::{error, info};
use tracing::info;

use crate::server::MainServer;

Expand All @@ -11,14 +11,11 @@ mod server;

const PORT: u16 = 8082;

pub fn start() {
pub fn start() -> Result<(), String> {
info!("Starting...");

task::block_on(task::spawn(async {
if let Err(error) = start_inner().await {
error!("{:?}", error);
}
}));
start_inner().await.map_err(|error| format!("{:?}", error))
}))
}

async fn start_inner() -> anyhow::Result<()> {
Expand Down
12 changes: 9 additions & 3 deletions crates/connector/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
use de_connector_lib::start;
use tracing::Level;
use tracing::{error, Level};
use tracing_subscriber::FmtSubscriber;

fn main() {
fn main() -> Result<(), String> {
let subscriber = FmtSubscriber::builder()
.with_max_level(Level::TRACE)
.finish();
tracing::subscriber::set_global_default(subscriber).unwrap();
start();

let result = start();
if let Err(message) = result.as_ref() {
error!(message);
}

result
}

0 comments on commit af1c4bd

Please sign in to comment.