oop fix another unwrap

This commit is contained in:
mat 2022-10-29 14:02:57 -05:00
parent f235c9d064
commit 65d8fdcb6c
2 changed files with 4 additions and 2 deletions

View file

@ -14,7 +14,7 @@ pub mod ping;
mod player; mod player;
pub use account::Account; pub use account::Account;
pub use client::{Client, ClientInformation, Event}; pub use client::{Client, ClientInformation, Event, JoinError};
pub use movement::MoveDirection; pub use movement::MoveDirection;
pub use player::Player; pub use player::Player;

View file

@ -123,6 +123,8 @@ where
pub enum Error { pub enum Error {
#[error("Invalid address")] #[error("Invalid address")]
InvalidAddress, InvalidAddress,
#[error("Join error: {0}")]
Join(#[from] azalea_client::JoinError),
} }
/// Join a server and start handling events. This function will run forever until /// Join a server and start handling events. This function will run forever until
@ -151,7 +153,7 @@ pub async fn start<
Err(_) => return Err(Error::InvalidAddress), Err(_) => return Err(Error::InvalidAddress),
}; };
let (bot, mut rx) = Client::join(&options.account, address).await.unwrap(); let (bot, mut rx) = Client::join(&options.account, address).await?;
let state = options.state; let state = options.state;
let bot_plugin = bot::Plugin::default(); let bot_plugin = bot::Plugin::default();