Skip to content

Commit

Permalink
feat(debug): add support for debug message
Browse files Browse the repository at this point in the history
  • Loading branch information
fu050409 committed Apr 7, 2024
1 parent ce0f916 commit e4ae8a2
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/models/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,15 @@ async fn _handle(
.await
{
Ok(status_code) => status_code,
Err(_) => {
return Err(anyhow!(OblivionException::ServerError {
method: request.get_method(),
ipaddr: request.get_ip(),
olps: request.get_olps(),
status_code: 501,
}));
Err(error) => {
eprintln!(
"Oblivion/1.1 {} From {} {} {}",
request.get_method(),
request.get_ip(),
request.get_olps(),
501
);
return Err(Error::from(error));
}
};

Expand All @@ -161,7 +163,7 @@ pub async fn handle(router: Router, stream: TcpStream, peer: SocketAddr) {
status_code
);
}
Err(error) => println!("{}", error),
Err(error) => eprintln!("{}", error),
}
}

Expand All @@ -187,7 +189,7 @@ impl Server {
let tcp = match TcpListener::bind(format!("{}:{}", self.host, self.port)).await {
Ok(tcp) => tcp,
Err(_) => {
println!(
eprintln!(
"{}",
OblivionException::AddressAlreadyInUse {
ipaddr: self.host.clone(),
Expand Down

0 comments on commit e4ae8a2

Please sign in to comment.